G
Guest
Trying to do a stored procedure in C# against Microsoft Access. I just want
to do a simple select to do a lookup. Unfortunately all of the examples I
can find are for SQL 2000 Server, and they don't seem to work in Access. I
am very familiar with Data Adapters and passing parms that way. I just am
stuck trying to create the stored procedure in Access because I can't get the
Parameter syntax right. It keeps returning a Parameter Syntax Error.
OleDbCommand createCMD = new OleDbCommand();
createCMD.Connection = myConn;
createCMD.CommandText = "CREATE PROCEDURE GetResident " +
"(@ResidentNo int, " +
"@ResidentName char(25) OUTPUT, " +
"@ResidentCity char(25) OUTPUT) " +
"AS " +
"SELECT ResidentName, ResidentCity FROM RESIDENT " +
"WHERE ResidentNo = @ResidentNo";
createCMD.ExecuteNonQuery();
to do a simple select to do a lookup. Unfortunately all of the examples I
can find are for SQL 2000 Server, and they don't seem to work in Access. I
am very familiar with Data Adapters and passing parms that way. I just am
stuck trying to create the stored procedure in Access because I can't get the
Parameter syntax right. It keeps returning a Parameter Syntax Error.
OleDbCommand createCMD = new OleDbCommand();
createCMD.Connection = myConn;
createCMD.CommandText = "CREATE PROCEDURE GetResident " +
"(@ResidentNo int, " +
"@ResidentName char(25) OUTPUT, " +
"@ResidentCity char(25) OUTPUT) " +
"AS " +
"SELECT ResidentName, ResidentCity FROM RESIDENT " +
"WHERE ResidentNo = @ResidentNo";
createCMD.ExecuteNonQuery();