cesark
Programmer
- Dec 20, 2003
- 621
Hi !
I usually use Stored Procedures inside Sql Server from my aspx pages, but for data that is retrieved to fill a dropdownlist and other form controls I use this structure:
Is it better that I use stored procedures always where possible in operations with the database? Including my code example?
Thank you,
Cesar
I usually use Stored Procedures inside Sql Server from my aspx pages, but for data that is retrieved to fill a dropdownlist and other form controls I use this structure:
Code:
Dim Cmd1 As New SqlCommand("Select Field1, Field2 From Table1", strConnection)
strConnection.Open()
Dim var1 As SqlDataReader = Cmd1.ExecuteReader(CommandBehavior.CloseConnection)
Control1.DataSource = var1
Control2.DataBind()
Thank you,
Cesar