I am attempting to run an Access append query in C# using OleDbCommand.
As a test I created two queries in the database (one a copy of the other)
AppendMe
Append Me
AppendMe
works fine but when I attempt to execute the second Append Me
I get an OleDbException
"cannot find the input table or query 'Append'" In other words its only seeing the first word of the string. I've tried manipulating the string (using verbatim string etc)
OleDbConnection conn = new OleDbConnection(connStr);
conn.Open();
string StdProc = "Append Me";
OleDbCommand cmd = new OleDbCommand(StdProc, conn);
cmd.CommandType = CommandType.StoredProcedure;
OleDbDataReader rdr = cmd.ExecuteReader();
If an SQL indentifier contains funny characters, such as a space, it must be enclosed in square brackets.
[Append Me]
精彩评论