MS Access

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

Hello, I have worked with Stored procedures in SQL and now I am trying to
figure out how to do the same or similar in MS Access. I created a simple
query which is asking for the user to enter the first character of the last
name.

When I run this in Access, I get the prompt which ask me to enter the first
character of the last name. I works just fine.

Now when I attempt to run this query from a C# client, I am not quite sure
how to call this procedure. Do I create a Parameter for the command? What
would the parameter be called? Do I indicate that The command type is a
"Stored procedure"?. Not sure how to proceed.

Any advice you can provide would be greatly appreciated!!!!!!
 
Hi Jim,


Jim Heavey said:
Hello, I have worked with Stored procedures in SQL and now I am trying to
figure out how to do the same or similar in MS Access. I created a simple
query which is asking for the user to enter the first character of the last
name.

When I run this in Access, I get the prompt which ask me to enter the first
character of the last name. I works just fine.

Now when I attempt to run this query from a C# client, I am not quite sure
how to call this procedure. Do I create a Parameter for the command?
Yes.

What
would the parameter be called?

Doesn't matter - the order matters.

Do I indicate that The command type is a
"Stored procedure"?.

Yes.
 
¤ Hello, I have worked with Stored procedures in SQL and now I am trying to
¤ figure out how to do the same or similar in MS Access. I created a simple
¤ query which is asking for the user to enter the first character of the last
¤ name.
¤
¤ When I run this in Access, I get the prompt which ask me to enter the first
¤ character of the last name. I works just fine.
¤
¤ Now when I attempt to run this query from a C# client, I am not quite sure
¤ how to call this procedure. Do I create a Parameter for the command? What
¤ would the parameter be called? Do I indicate that The command type is a
¤ "Stored procedure"?. Not sure how to proceed.
¤
¤ Any advice you can provide would be greatly appreciated!!!!!!

See the OLEDB examples in the below MS KB article. The only different should be the connection
string you use. As Miha mentioned, OLEDB depends upon the ordinal position of the parameter. You can
use named parameters but you cannot order the parameters by name as they are ignored by OLEDB.

HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;EN-US;310070


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top