here is my code

Dim oledbcom As New OleDb.OleDbCommand
oledbcom.CommandText = ("INSERT INTO Customer Company, Address, Telephone values ?,?,?")
oledbcom.Connection = oledbcon

Dim oledbparam As OleDb.OleDbParameter = _
oledbcom.Parameters.Add("@Company", OleDb.OleDbType.VarChar, 30)
oledbparam.Value = txtCompName.Text.Trim()

oledbparam = oledbcom.Parameters.Add("@Address", OleDb.OleDbType.VarChar, 80)
oledbparam.Value = txtAddress.Text.Trim

oledbparam = oledbcom.Parameters.Add("@Telephone", OleDb.OleDbType.VarChar, 15)
oledbparam.Value = txtContact.Text.Trim

oledbcom.ExecuteNonQuery()

Recommended Answers

All 3 Replies

Didn't test it but if I remember right

oledbcom.CommandText = ("INSERT INTO Customer Company, Address, Telephone values ?,?,?")

should be

oledbcom.CommandText = ("INSERT INTO Customer (Company, Address, Telephone) values (?,?,?)")

HTH

thnx a ton.
tht worked grt.

Hi! Nice to hear that you got answer to your problem. Could you please mark the thread as solved. Thank you!

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.