1 Replies - 939 Views - Last Post: 04 March 2010 - 12:32 AM Rate Topic: -----

#1 inksterjim   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-March 10

SQl insert

Posted 03 March 2010 - 05:22 PM

Hi Everybody in VB land.

Whoops posted too soon.

I'm trying to add a simple SQLcommand to a table and it's giving me a problem...

Using cmd As New SqlCommand("INSERT INTO TableB (ID, [Name], DOB, [Date]) VALUES (@intID, @txtName, @dtDOB, @timeStamp", cn)

I thought a variable that is going to be inserted into a table column must be preceded with an '@' sign, but I get this error when I try to INSERT...

Insert failed: Must declare the scalar variable "@intID".

I have intID defined as: Dim intID As Integer = CInt(TextBox1.Text)

Is there something wrong with my syntax?


Is This A Good Question/Topic? 0
  • +

Replies To: SQl insert

#2 gregoryH   User is offline

  • D.I.C Addict
  • member icon

Reputation: 60
  • View blog
  • Posts: 656
  • Joined: 04-October 06

Re: SQl insert

Posted 04 March 2010 - 12:32 AM


Without knowing your table structure, its a bit hard to comment on your problem.

Would I be imposing to ask you to post the table create statement for your data?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1