T
tshad
I am trying to build my own DB Class and am trying to set up my parameter
list in an array of SqlParameter objects.
In my regular code I would do something like:
*********************************************************
Dim dbCmd As SqlCommand = New SqlCommand("GetUsers", dbConn)
dbCmd.CommandType = CommandType.StoredProcedure
dbCmd.Parameters.Add("@UserID",SqlDBType.Int).value = 1
************************************************************
In this I add the the value dircectly into the .Add SqlParameter statement.
In my class, I get an error if I do the same thing and have to do the
assignment afterwords:
**************************************
Sub LoadGrid()
Dim parameters as SqlParameter() = { _
New SqlParameter("@UserID",SqlDBType.Int) }
parameters(0).value = 1
*****************************************
Is there a way to do the above line in one statement, such as:
New SqlParameter("@UserID",SqlDBType.Int).value = 1
Thanks,
Tom
list in an array of SqlParameter objects.
In my regular code I would do something like:
*********************************************************
Dim dbCmd As SqlCommand = New SqlCommand("GetUsers", dbConn)
dbCmd.CommandType = CommandType.StoredProcedure
dbCmd.Parameters.Add("@UserID",SqlDBType.Int).value = 1
************************************************************
In this I add the the value dircectly into the .Add SqlParameter statement.
In my class, I get an error if I do the same thing and have to do the
assignment afterwords:
**************************************
Sub LoadGrid()
Dim parameters as SqlParameter() = { _
New SqlParameter("@UserID",SqlDBType.Int) }
parameters(0).value = 1
*****************************************
Is there a way to do the above line in one statement, such as:
New SqlParameter("@UserID",SqlDBType.Int).value = 1
Thanks,
Tom