I have created and saved a named query in an Access 2010 database with one parameter. However I cannot seem to be able to use it via VB.NET OleDb.
Here's the code I'm using (disregard the connection, which is set up correctly - it works using non-stored procedures)
Dim Command As New OleDb.OleDbCommand
Dim Reader As OleDb.OleDbDataReader
Command.CommandText = "SelectUser"
Command.Parameters.AddWithValue("@UserId", "1234131")
Command.CommandType = CommandType.StoredProcedure
Reader = Command.ExecuteReader
This is the code of the stored procedure in Access 2010:
SELECT Users.*
FROM Users
WHERE Users.User_Id=[@UserId];
When executing the .NET code, I'm getting the following exception: The Microsoft Access database engine cannot find the input table or query 'SelectUser'. Make sure it exists and that its name is spelled correctly.
What am I doing wrong, to me this make no sense.
Connected to the wrong copy of the database, a copy that did not contain the query.