Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

my ms access connectivity in a c sharp program does not work it shows error in the ExecuteNonQuery() line with an error message "Syntax error in INSERT INTO statement."... can anyone help.....??

OpenStudy (anonymous):

private void button1_Click(object sender, EventArgs e) { desc = textBox3.Text; amount = Convert.ToDouble(textBox4.Text); Form1 firstform = new Form1(); string s1 = "INSERT INTO User (Description) VALUES ('" + Convert.ToString(textBox3.Text)+ "')"; OleDbConnection thisConnection = new OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0; Data Source=C:\\Documents and Settings\\hello\\My Documents\\Visual Studio 2010\\Projects\\WindowsFormsApplication4\\WindowsFormsApplication4\\bin\\Debug\\Database2.mdb"); thisConnection.Open(); OleDbCommand thisCommand = new OleDbCommand(); thisCommand.Connection = thisConnection; thisCommand.CommandText = s1; thisCommand.ExecuteNonQuery(); thisConnection.Close(); textBox3.Clear(); textBox4.Clear(); } This is my coding....

OpenStudy (anonymous):

print out the SQL to the console and make sure the syntax of the statement is what you expect.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!