943,907 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 940
  • VB.NET RSS
Jul 5th, 2009
0

syntax error in INSERT INTO statement

Expand Post »
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()
Reputation Points: -1
Solved Threads: 23
Posting Whiz in Training
babbu is offline Offline
207 posts
since Jun 2009
Jul 5th, 2009
1

Re: syntax error in INSERT INTO statement

Didn't test it but if I remember right
VB.NET Syntax (Toggle Plain Text)
  1. oledbcom.CommandText = ("INSERT INTO Customer Company, Address, Telephone values ?,?,?")
should be
VB.NET Syntax (Toggle Plain Text)
  1. oledbcom.CommandText = ("INSERT INTO Customer (Company, Address, Telephone) values (?,?,?)")

HTH
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Jul 5th, 2009
0

Re: syntax error in INSERT INTO statement

thnx a ton.
tht worked grt.
Reputation Points: -1
Solved Threads: 23
Posting Whiz in Training
babbu is offline Offline
207 posts
since Jun 2009
Jul 5th, 2009
0

Re: syntax error in INSERT INTO statement

Hi! Nice to hear that you got answer to your problem. Could you please mark the thread as solved. Thank you!
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: help me out
Next Thread in VB.NET Forum Timeline: ListView Small Probs





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC