I want to access an Access database, try catch block gave me the error that "syntax error in INSERT INTO statement" while I'm sure that the syntax is true!! what is the problem I don't know!! I need to insert data into that database, plz help!! thx
Hi, I've a problem with C#.NET MS visual studio.NET 2003 , any body can help? I'll appreciate that!!?
The INSERT statement must be wrong then. If you are building the Query dynamically, then watch for spaces between the words.
Reply:End the statement with a semicolon
Reply:command = new OleDbCommand();
command.Connection = new OleDbConnection(Provider=Microsoft.Jet.O... Source=[databaseFilename]);
command.CommandText = "Insert into BOB set Name = hello;";
try
{
command.Connection.Open();
command.ExecuteNonQuery();
}
catch(OleDbException e)
{
throw new Exception(e.Message);
}
Finally
{
command.Connection.Close();
}
apricot
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment