G
Guest
I get a syntax error every time I try to use an INSERT statement. My statement is correct. Strings seem to be the problem. The primary key is a number and that's the only field I can insert
Doesn't Work
db.InsertCommand.CommandText = "INSERT INTO Person(ID, First, MI, Last, Address, Phone, Parents_Names, School, Grade, Comments, Type) VALUES (9, '" + name.Text + "', '" + mi.Text + "', '" + last.Text + "', '" + address.Text + "', '" + phone.Text + "', '" + parents.Text + "', '" + school.Text + "', '" + grade.Text + "', '" + comments.Text + "', 'S')"
Doesn't Wor
db.InsertCommand.CommandText = "INSERT INTO Person(Last) VALUES('Smith')"
Works
db.InsertCommand.CommandText = "INSERT INTO Person(ID) VALUES(3)";
Doesn't Work
db.InsertCommand.CommandText = "INSERT INTO Person(ID, First, MI, Last, Address, Phone, Parents_Names, School, Grade, Comments, Type) VALUES (9, '" + name.Text + "', '" + mi.Text + "', '" + last.Text + "', '" + address.Text + "', '" + phone.Text + "', '" + parents.Text + "', '" + school.Text + "', '" + grade.Text + "', '" + comments.Text + "', 'S')"
Doesn't Wor
db.InsertCommand.CommandText = "INSERT INTO Person(Last) VALUES('Smith')"
Works
db.InsertCommand.CommandText = "INSERT INTO Person(ID) VALUES(3)";