TheInsider
Programmer
(I also posted this in the SQL Server forum)
Hello,
Real simple question here. I am working on an ASP page and would like some clarification on when I will benefit from using stored procedures and when I will not.
I have a table that has 2 columns -- column 1 is a TinyInt primary key and column 2 is a VarChar(30). The table has about 60 records.
If I simply want to populate a combobox with the data from this table; will I really get any benefit by creating a stored procedure to call the "SELECT * FROM MyTable" statement? I don't even need to sort the records, as I have entered them into the table in the order that I want them already.
By creating a stored procedure I would have to use 3 ADO objects -- a Connection, a Command object, and a Recordset to receive the records from the Command object.
By using an embedded SQL string in my ASP page I only need 2 ADO objects -- a Connection and a Recordset.
This webpage will have a high volume of users at any given time. Is their any advantage of using the stored procedure here over the SQL string in ASP?
One other case: if I am inserting a record into a table that has 12 columns, the data coming from an ASP page; would this be an appropriate place to use a stored procedure to do the actual inserting with "INSERT INTO...", as opposed to doing it in the ASP page?
This is another case of 2 objects to multiple. If I use a Command object to simply insert from a SQL string, I only need a Connection object and a Command object. If I use a stored procedure, I would need both of those objects + a Parameter object which I would call the CreateParameter function on 12 times!
I have many books on ASP and SQL Server, but none clarify this.
Thanks
Hello,
Real simple question here. I am working on an ASP page and would like some clarification on when I will benefit from using stored procedures and when I will not.
I have a table that has 2 columns -- column 1 is a TinyInt primary key and column 2 is a VarChar(30). The table has about 60 records.
If I simply want to populate a combobox with the data from this table; will I really get any benefit by creating a stored procedure to call the "SELECT * FROM MyTable" statement? I don't even need to sort the records, as I have entered them into the table in the order that I want them already.
By creating a stored procedure I would have to use 3 ADO objects -- a Connection, a Command object, and a Recordset to receive the records from the Command object.
By using an embedded SQL string in my ASP page I only need 2 ADO objects -- a Connection and a Recordset.
This webpage will have a high volume of users at any given time. Is their any advantage of using the stored procedure here over the SQL string in ASP?
One other case: if I am inserting a record into a table that has 12 columns, the data coming from an ASP page; would this be an appropriate place to use a stored procedure to do the actual inserting with "INSERT INTO...", as opposed to doing it in the ASP page?
This is another case of 2 objects to multiple. If I use a Command object to simply insert from a SQL string, I only need a Connection object and a Command object. If I use a stored procedure, I would need both of those objects + a Parameter object which I would call the CreateParameter function on 12 times!
I have many books on ASP and SQL Server, but none clarify this.
Thanks