T
tshad
I have an SqlParameter array that I want to reuse after I have used it.
For example, I have the following code that calls my generic db routines:
***********************************************
Dim myDbObject as new DbObject()
Dim DBReader As SqlDataReader
Dim parameters As SqlParameter () = { _
New SqlParameter("@ClientID",SqldbType.VarChar,20), _
New SqlParameter("@UserName",SqlDbType.VarChar,20), _
New SqlParameter("@Password",SqlDbType.VarChar,20) }
parameters(0).value = session("ClientID")
parameters(1).value = UserName.text
parameters(2).value = Password.Text
dbReader = myDbObject.RunProcedure("GetUserInfo", parameters)
******************************************************
I now want to use the same parameters but this time I have only @ClientID
and @Password:
Dim parameters As SqlParameter () = { _
New SqlParameter("@ClientID",SqldbType.VarChar,20) ,
New SqlParameter("@Password",SqlDbType.VarChar,20) )
Now in my old way I would clear the parameters of the SqlCommand object like
so:
Dim objCmd as New SqlCommand(CommandText,objConn)
....
objCmd.Parameters.Clear()
How do I do that with my SqlParameter array?
Also, I pass my parameters to my routine as "ByVal parameters As
IDataParameter()". If I have no parameters, how would I set up my Dim to
show there are no parameters (I still need to send a parameter array).
Thanks,
Tom
For example, I have the following code that calls my generic db routines:
***********************************************
Dim myDbObject as new DbObject()
Dim DBReader As SqlDataReader
Dim parameters As SqlParameter () = { _
New SqlParameter("@ClientID",SqldbType.VarChar,20), _
New SqlParameter("@UserName",SqlDbType.VarChar,20), _
New SqlParameter("@Password",SqlDbType.VarChar,20) }
parameters(0).value = session("ClientID")
parameters(1).value = UserName.text
parameters(2).value = Password.Text
dbReader = myDbObject.RunProcedure("GetUserInfo", parameters)
******************************************************
I now want to use the same parameters but this time I have only @ClientID
and @Password:
Dim parameters As SqlParameter () = { _
New SqlParameter("@ClientID",SqldbType.VarChar,20) ,
New SqlParameter("@Password",SqlDbType.VarChar,20) )
Now in my old way I would clear the parameters of the SqlCommand object like
so:
Dim objCmd as New SqlCommand(CommandText,objConn)
....
objCmd.Parameters.Clear()
How do I do that with my SqlParameter array?
Also, I pass my parameters to my routine as "ByVal parameters As
IDataParameter()". If I have no parameters, how would I set up my Dim to
show there are no parameters (I still need to send a parameter array).
Thanks,
Tom