R
Rob
Please recommend best practice for adding a global
variable to an ASP.net class that will take on a
Request.Params("") value from the URL calling the aspx
page to be used throughout in stored procedure calls as a
parameter in datagrids.
Currently, the best I came up with was to add code around
the Web Form Designer code of the Select statement that
defines the variable and sends it as a Parameter to the
stored procedure. However, Visual studio keeps
overwriting this code everytime I use the GUI tools on the
data objects. Using variable in Select Stored Procedure
paramater call in the Value area.
Is there a better/easier way to send the variable in the
GUI "control source" or value for the data adapter select
statement sp call?
Thank you,
Rob
----
'
'SqlSelectCommand1
'
'RW - Attempt to globally define EmployeeID from
URL paramater for stored procedure
If Not (Request.Params("EmployeeID") Is Nothing)
Then
EmployeeID = Int32.Parse(Request.Params
("EmployeeID"))
Else
EmployeeID = "302"
End If
'/RW
Me.SqlSelectCommand1.CommandText
= "[spGetEmpAttach]"
Me.SqlSelectCommand1.CommandType =
System.Data.CommandType.StoredProcedure
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@RETURN_VALUE",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.ReturnValue, False, CType
(0, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
'RW
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@EmployeeID",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, False, CType(0,
Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, EmployeeID))
'/RW
variable to an ASP.net class that will take on a
Request.Params("") value from the URL calling the aspx
page to be used throughout in stored procedure calls as a
parameter in datagrids.
Currently, the best I came up with was to add code around
the Web Form Designer code of the Select statement that
defines the variable and sends it as a Parameter to the
stored procedure. However, Visual studio keeps
overwriting this code everytime I use the GUI tools on the
data objects. Using variable in Select Stored Procedure
paramater call in the Value area.
Is there a better/easier way to send the variable in the
GUI "control source" or value for the data adapter select
statement sp call?
Thank you,
Rob
----
'
'SqlSelectCommand1
'
'RW - Attempt to globally define EmployeeID from
URL paramater for stored procedure
If Not (Request.Params("EmployeeID") Is Nothing)
Then
EmployeeID = Int32.Parse(Request.Params
("EmployeeID"))
Else
EmployeeID = "302"
End If
'/RW
Me.SqlSelectCommand1.CommandText
= "[spGetEmpAttach]"
Me.SqlSelectCommand1.CommandType =
System.Data.CommandType.StoredProcedure
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@RETURN_VALUE",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.ReturnValue, False, CType
(0, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
'RW
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@EmployeeID",
System.Data.SqlDbType.Int, 4,
System.Data.ParameterDirection.Input, False, CType(0,
Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, EmployeeID))
'/RW