开发者

OleDbCommand Stored Procedure Cannot Find Access Query

开发者 https://www.devze.com 2023-03-17 08:36 出处:网络
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)

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)

  1. AppendMe
  2. 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)

Nothing works.

I开发者_StackOverflow am using c# Express 2010 and Access 2003

Here's an extract of the code

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消