Migration of data from access to excel and vice versa

This consist of window form that will translate data from access to excel and show the data in the datagrid.



Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents DataGrid2 As System.Windows.Forms.DataGrid
Private Sub InitializeComponent()
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.DataGrid2 = New System.Windows.Forms.DataGrid
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataGrid2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.CaptionText = "ACCESS DATA"
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(3, 0)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(320, 248)
Me.DataGrid1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(331, 97)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(120, 23)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Access Data"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(331, 129)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(120, 23)
Me.Button2.TabIndex = 2
Me.Button2.Text = "Send To SQL."
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(331, 65)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(120, 23)
Me.Button3.TabIndex = 3
Me.Button3.Text = "Update Access Data"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(331, 161)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(120, 23)
Me.Button4.TabIndex = 4
Me.Button4.Text = "Show Sql Data"
'
'DataGrid2
'
Me.DataGrid2.CaptionText = "ACCESS DATA"
Me.DataGrid2.DataMember = ""
Me.DataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid2.Location = New System.Drawing.Point(464, 0)
Me.DataGrid2.Name = "DataGrid2"
Me.DataGrid2.Size = New System.Drawing.Size(320, 248)
Me.DataGrid2.TabIndex = 5
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(768, 273)
Me.Controls.Add(Me.DataGrid2)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.DataGrid1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataGrid2, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
Dim c As New connectionclass
Dim t As New DataTable
Dim st As New DataTable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
t = c.datafill("test")
t.DefaultView.AllowNew = True
t.DefaultView.AllowDelete = True
t.DefaultView.AllowEdit = True
DataGrid1.DataSource = t
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If c.updatefill("test", t) = True Then
MsgBox("Record Updated")
Else
MsgBox("Recrods not updated")
End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If c.supdate("test", t) = True Then
MsgBox("Records updated in SQL")
Else
MsgBox("Records not updated")
End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
st = c.datafill("test")
t.DefaultView.AllowNew = True
t.DefaultView.AllowDelete = True
t.DefaultView.AllowEdit = True
DataGrid2.DataSource = t
End Sub
End Class


Attachments

  • Migration of data from access to excel and vice versa (30828-281115-MigrationofData.rar)
  • Comments

    No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: