Hello :)

I'm trying to create web application. I followed the tutorial given in this site :
http://aspsnippets.c...-in-ASPNet.aspx

My problem now, after I create a table and the UI. Next step show about stored procedure.
What is stored procedure use for? Do I need this even though I had a table in my database?

I'm using SQL Server Management Studio 2008 as my database platform.

Thank you :)

Hi

That link points back to this page so not sure which tutorial you are currently following.

In terms of what is a stored procedure, it is simply a prepared SQL statement that can be executed multiple times. For example, imagine that you have a table storing contact information (ID, Name, Age, Address etc.). If you want to get a record by ID you could write a straightforward SELECT statement such as: SELECT Name, Age, Address From ContactsTable WHERE ID = @IDParameter. Or you could create a stored procedure such as:

CREATE PROCEDURE GetContactByID
@ID int
AS
SELECT Name, Age, Address From ContactsTable WHERE ID=@ID

and then simply execute the stored procedure passing the parameter value using Exec GetContactByID 1.

Stored procedures are useful when your queries are quite complex such as using cursors or temporary tables. For basic stuff, simple SQL is sufficient. There is also a potential performance gain with stored procedures as they can be cached, but from what I understand, SQL Server has been caching the execution plans of standard queries for some time now so this may be an invalid point.

Hi djjeavons.

Thank you for your response. Actually, i'm following this tutorial Click Here.

Ok, now i get a basic view about this stored procedure and i will try the solution that you had suggested to me. Later on i tell the feedback about this.

Again, thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.