Create a SqlParamArray
Posted on 2004-11-12
I'm trying to learn to use MS's Data Application Block which wraps a bunch of db connection stuff. I'm having problem calling the method below when I get to the point of passing in the ParamArray arg. I'm seeing lots of documentation about creating parameters for the DataAdapter and SqlCommand objects but not for creating a ParamArray from scratch.
ExecuteDataset(ByVal connection As SqlConnection, _
ByVal commandType As CommandType, _
ByVal commandText As String, _
ByVal ParamArray commandParameters() As SqlParameter)
I would _think I'd be able to do something like:
Dim myParams = New System.Data.SqlClient.SqlParameter
myParams.Add("@facilityID", SqlDbType.Int).Value = "11111"
myParams.Add("@Address", SqlDbType.Int).Value = "11 Elm Street"
But um....obviously not.