Best way to call a stored procedure

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

H

There are two ways to execute a stored procedure using ADO.NE
- call "exec sp_myproc val1,val2" statement over ADO SqlCommand myCommand = new SqlCommand(SQLQuery, mySqlConnection)
- use Command/Parameters objects to initialize and call the stored procedure

Which is a efficient way and wh

Appreciate your respons

Thank
Mik
 
Mike,

Using a SqlCommand and using parameters is the prefered way and it is the
most secure way since it help you protect your database from SQL Injection,
but enableing you to add type support and being able to control parameter
lenght etc.

//Andreas

mike said:
Hi

There are two ways to execute a stored procedure using ADO.NET
- call "exec sp_myproc val1,val2" statement over ADO SqlCommand myCommand
= new SqlCommand(SQLQuery, mySqlConnection);
 

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

Back
Top