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();
aaj - 29 Apr 2005 12:01 GMT
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
> Trying to do a stored procedure in C# against Microsoft Access. I just
> want
[quoted text clipped - 16 lines]
> "WHERE ResidentNo = @ResidentNo";
> createCMD.ExecuteNonQuery();
aaj - 29 Apr 2005 12:06 GMT
Sorry, it would seem it does now, learn something new every day!!
http://www.devcity.net/Articles/18/msaccess_sp.aspx
gives some Vb.net example, perhaps thay might be of use?
> I'm not sure that Access supports stored procedures
>
[quoted text clipped - 27 lines]
>> "WHERE ResidentNo = @ResidentNo";
>> createCMD.ExecuteNonQuery();
Brian Kitt - 29 Apr 2005 18:04 GMT
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.
> 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
[quoted text clipped - 13 lines]
> "WHERE ResidentNo = @ResidentNo";
> createCMD.ExecuteNonQuery();