June 11, 2006 at 1:10 pm
Hi
I'm doing a project in visual studio 2005 using SQL express 2005 for data access.The database is implemented in the APP_DATA folder of the application. I just want to ask: which is better for data access: stored procedures or query strings?
If you have any idea that can make the project more performent.
thanks
June 12, 2006 at 2:03 am
If you have a well designed DB that will not need constant changes SP's are good to keep your DB access etc seperate from your .Net code. On the other hand sql query strings are easier to update as when you change a SP you may also have to change your code. SP can also provide better performance as your just executing them not having to pass the whole query to the DB. You may find a mixture of the two is better.
Have you thought about typed datasets, below is a link to an article on the benifits of them and how VS 2005 helps you out.
http://aspnet.4guysfromrolla.com/articles/020806-1.aspx
Regards
Brin
June 12, 2006 at 3:50 am
Thanks
June 12, 2006 at 5:33 am
It depends on what you're trying to do. A small SQLExpress box only the one user touches... you probably won't see any noticeable performance gains using stored procedures. And if the user isn't touching the SQL Server directly, then the following doesn't really apply either:
Stored procedures prevent unexpected data access because it eliminates the need to touch the base tables. If a given user has the ability to DELETE from a table, that user has the ability to delete all records from the table. However, if the user has execute rights on a stored procedure that controls how data is deleted, the user doesn't need DELETE rights on the table (with the assumption ownership chaining is taken advantage of). While this isn't strictly a performance improvement, it can be (imagine a user running SELECT * FROM ... against a several million row table). However, from a security perspective, it's often better to use stored procedures.
K. Brian Kelley
@kbriankelley
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply