This are my field in my MDB file:
Field Name Data Type Description
===========================================================
c_id AutoNumber Customer ID [Primary Key]
c_date Date/Time Current Date [Now]
c_name Text Customer Name [TextBox1.Text]
c_mail Text Customer Email [TextBox2.Text]
===========================================================
The only field that I have to update are the "c_name" and "c_mail". And I use this code;
Dim cn As New OleDbConnection
Dim cm As New OleDbCommand("INSERT INTO table1 VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "'")
Dim rd As OleDbDataReader
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; data source=D:\my.mdb"
cn.Open()
cm.Connection = cn
rd = cm.ExecuteReader()
cn.Close()
But this code doesn't work.. Kindly correct this code for me?? What code should I write??


Reply With Quote