Pgmer
Practically a Posting Shark
881 posts since Apr 2008
Reputation Points: 60
Solved Threads: 158
Skill Endorsements: 1
Don't Use AND
Query = "INSERT INTO PROD_DB_Complete_Board (ID, [Board Size], Laminate, [Stock Level]) Values('" & TextBox4.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox1.Text & "')"
Jx_Man
Senior Poster
3,529 posts since Nov 2007
Reputation Points: 1,482
Solved Threads: 516
Skill Endorsements: 64
Syntax for insert into is as below
INSERT INTO TABLENAME(
COLUMN1,
COLUMN2,
COLUMN3,
)
VALUES(VALUE1,
VALUE12,
VALUE13,)
Pgmer
Practically a Posting Shark
881 posts since Apr 2008
Reputation Points: 60
Solved Threads: 158
Skill Endorsements: 1
What is the error message? Why cant u take the Query before running cmd.ExecuteNonQuery() and try to run on SQL server?
Pgmer
Practically a Posting Shark
881 posts since Apr 2008
Reputation Points: 60
Solved Threads: 158
Skill Endorsements: 1
You wrong when put commas n single quotes. did u see my post?
Jx_Man
Senior Poster
3,529 posts since Nov 2007
Reputation Points: 1,482
Solved Threads: 516
Skill Endorsements: 64
Use
Query = "INSERT INTO PROD_DB_Complete_Board _
(ID, [Board Size], Laminate, [Stock Level]) _
Values('" & TextBox4.Text & "','" _
& "'" & TextBox2.Text & "','" _
& "'" & TextBox3.Text & "','" _
& "'" & TextBox1.Text & "')"
It's easier to see the problem when the fields line up. I don't knkow if you have the option, but I strongly suggest you modify the database so the field names do not contain spaces. You should remove them or replace them with underscores.
Reverend Jim
Carpe per diem
3,599 posts since Aug 2010
Reputation Points: 561
Solved Threads: 447
Skill Endorsements: 32
Question Answered as of 1 Year Ago by
Pgmer,
Jx_Man
and
Reverend Jim