How do I use the INSERT INTO
command from .NET to insert the contents of a variable Using CommandText
.
Here is what I have:
(On button press)
string test = txtFirstName.Text;
comm.CommandText = "INSERT INTO Store (FirstName) Values (test)";
Integers and strings in quotes work, just not from a variable, and I need the program to write the text that is in the textbox to the database.
I'm getting this error:
An exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll but was not handled in user code