joe_pool_is
Well-known member
My code:
produces this SQL statement:
but catches this error that is written to lblCreateMsg:
Am I using a reserved word? What would cause this problem?
Code:
strSql =
"INSERT INTO people
(Name, Email, Username, Password, Website, Dated) "
+ "VALUES (\"" +
strName + "\", \"" + strEmail + "\", \"" + strUserId + "\", \""
+ strPassword + "\", \"" + strUrl + "\", \"" + strDate + "\");";
Command1 = new OleDbCommand(strSql, Connection1);
try
{
Connection1.Open();
Command1.ExecuteNonQuery();
}
catch (Exception ex)
{
lblCreateMsg.Text = "Insert Database error:<br />";
lblCreateMsg.Text += ex.Message + "<br />" + strSql;
return;
} finally {
Connection1.Close();
}
Code:
INSERT INTO people
(Name, Email, Username, Password, Website, Dated)
VALUES
("John Doe", "[email="jdoe123@domain.com"]jdoe123@domain.com[/email]", "jdoe123",
"6184D6847D594EC75C4C07514D4BB490D5E166DF", "",
"9/17/2005 2:07:06 PM");
Code:
Syntax error in INSERT INTO statement.