Stored Procedure

G

Guest

I read that using stored procedures in your codes can make it more efficient.
But say if I only want to do simple queries like Select Col1 From Table1
Where Col1="ABC", should I actually use a stored procedure?
 
S

Steve C. Orr [MVP, MCSD]

The short answer is yes. One reason is that it's good to be consistent
about storing all your queries in one place. Another reason is that even a
simple query can give significant performance benefits if it's called
frequently and/or under heavy load. Another reason is the security that SQL
Server provides.

At very least use ADO.NET parameter objects even if you go with plain text
sql. They will protect you from SQL Injection Attacks.

Here's more info:
http://msdn.microsoft.com/library/d...systemdatasqlclientsqlparameterclasstopic.asp

http://msdn.microsoft.com/library/d...ngparameterizedstoredprocedurevisualbasic.asp
 
G

Guest

What I'm concerned here is that if I use a DataAdapter to update a table, I
can catch the DBConcurrencyException error and use it's Row property to get
the affected row. If I use a stored procedure to update my table, how do I
know when concurrency occurs? And how do I react?

Thank you.
 
S

Steve C. Orr [MVP, MCSD]

DataAdapters can call stored procedures, so I don't see any conflict.
 

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,773
Messages
2,569,594
Members
45,123
Latest member
Layne6498
Top