MS Access Query - use like stored procedure?

  • Thread starter Brenda Pasquarello
  • Start date
B

Brenda Pasquarello

If connecting to MS Access DB instead of SQL, can you call a query similar
to how you would call an SQL Stored Procedure?

Examples would be great!
 
M

Michael Bohman

Brenda Pasquarello skrev:
If connecting to MS Access DB instead of SQL, can you call a query similar
to how you would call an SQL Stored Procedure?

Examples would be great!
Of course

1. Create a stored procedure in access (create a new question, use SQL
button and create you're question example 'SELECT * FROM MyTable' or if
you wan't to assign values 'SELECT * FROM MyTable WHERE ID=[@ID]')

2.Use the following code in you're *.cs or *.vb form
....
objCmd = new OleDbCommand ("Name of you're sp in access",objConn);
objCmd.CommandType = CommandType.StoredProcedure;
// OBSERV THAT THE ORDER BETWENN THE FORM AND SP MUST BE SAME
objCmd.Parameters.Add("@ID",((TextBox)e.Item.FindControl("txtAdress")).Text);
// OPEN THE DATABASE...
objConn.Open();
objCmd.ExecuteNonQuery();
objConn.Close();

God luck, Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top