2 Replies - 268 Views - Last Post: 04 October 2012 - 10:46 AM Rate Topic: -----

#1 abhishek415  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 57
  • Joined: 30-June 12

Error in INSERT INTO Command

Posted 04 October 2012 - 10:24 AM

Hey Guys Help me finding error in this INSERT INTO Command.
My code is:


cmd.CommandText = "INSERT INTO Add (ProductID, SupplierID, PName, Quantity, Rate, ChemicalComp, Reorder) VALUES (@ProductID, @SupplierID, @PName, @Quantity, @Rate, @ChemicalComp, @Reorder)"
            With cmd
                .Parameters.AddWithValue("@ProductID", a)
                .Parameters.AddWithValue("@SupplierID", B)/>
                .Parameters.AddWithValue("@PName", c)
                .Parameters.AddWithValue("@Quantity", d)
                .Parameters.AddWithValue("@Rate", f)
                .Parameters.AddWithValue("@ChemicalComp", g)
                .Parameters.AddWithValue("@Reorder", h)
                .ExecuteNonQuery()
            End With



Please help me too.

Is This A Good Question/Topic? 0
  • +

Replies To: Error in INSERT INTO Command

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: Error in INSERT INTO Command

Posted 04 October 2012 - 10:29 AM

It would help to tell us what the error was you received.

I'm going to go ahead and assume a Syntax error as I think Add might be confusing the SQL parsing as a keyword

Either rename the table to something other than Add or wrap it with [] to denote that it is a name of a table. INSERT INTO [Add] ...
Was This Post Helpful? 1
  • +
  • -

#3 abhishek415  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 57
  • Joined: 30-June 12

Re: Error in INSERT INTO Command

Posted 04 October 2012 - 10:46 AM

Thanks Charlie... You was write. The error was in the name of the table.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1