Stored Procedure Newbie needs help

  • Thread starter Thread starter Guest
  • Start date Start date
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();
 
I'm not sure that Access supports stored procedures

As far as I remember it has QUERIES that are similar to VIEWS and you might
be able to use these its place, but no equivelent to TSQL

I might be wrong, but its worth a check before you go any further

Andy
 
Aha, there is a caveat there that says 'Output parameters are not supported'.
That is where my Stored Procedure keeps blowing up. So that's what my
problem is.
 
Back
Top