hi,

i had created a form with datagrid view , in that a table is linked with MS Access

database , i need the coding steps in vb.net

Recommended Answers

All 2 Replies

Oh please .... don't ask for code if you don't show any effort first.
Post what code you have so far and tell us where you stick. We are of course willing to help you but we are not going to code your stuff.

Imports System.Data
Imports System.Data.OleDb

Public Class Form1
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim da As New OleDbDataAdapter
Dim dtr As OleDbDataReader
Dim S12 As String
Dim row As Integer
Dim col As Integer
Dim currentTime As System.DateTime = System.DateTime.Now
Dim ds As New DataSet()

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'CustomerDataSet.test' table. You can move, or remove it, as needed.
Me.TestTableAdapter.Fill(Me.CustomerDataSet.test)
Dim s1 As String = "select * from test"
con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Customer.mdb")
da = New OleDbDataAdapter(s1, con)
con.Open()
da.Fill(ds, "test")
DataGridView1.DataSource = ds.Tables("test")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
con = New OleDbConnection("")
con.Open()
S12 = "insert into test (name)values('" + DataGridView1. + "'"
cmd = New OleDbCommand(S12, con)
cmd.ExecuteNonQuery()
MsgBox("inserted")
End Sub
End Class

""above is the code i had tried but each and every item in the datagrid view is not updated "",

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.