V
Vayse
Two questions
1) Can a Parameter Collection be created without a Command?
I've tried
Dim paramsCustomer As OleDbParameterCollection
paramsCustomer.Add(New OleDbParameter("CustomerBalance", OleDbType.Single,
8, "CustomerBalance"))
paramsCustomer.Add(New OleDbParameter("CustomerId", OleDbType.SmallInt, 8,
"CustomerId"))
But it won't work. I get "Object reference not set to an instance of an
object."
So for now, I have to add paramsCustomer = cmdTest.Parameters after the Dim
statement.
Is there any way around this?
2) Passing the Parameters Collection
So I have a function like this:
Function UpdateTable(ByVal stCommandText As String, ByVal Params As
OleDbParameterCollection, ByVal dtOrig As DataTable) As Long
Dim cmdUpdate As New OleDbCommand(stCommandText, connData)
How do I set cmdUpdate parameters to the Params that I pass? Can't get it to
work.
Thanks
Vayse
1) Can a Parameter Collection be created without a Command?
I've tried
Dim paramsCustomer As OleDbParameterCollection
paramsCustomer.Add(New OleDbParameter("CustomerBalance", OleDbType.Single,
8, "CustomerBalance"))
paramsCustomer.Add(New OleDbParameter("CustomerId", OleDbType.SmallInt, 8,
"CustomerId"))
But it won't work. I get "Object reference not set to an instance of an
object."
So for now, I have to add paramsCustomer = cmdTest.Parameters after the Dim
statement.
Is there any way around this?
2) Passing the Parameters Collection
So I have a function like this:
Function UpdateTable(ByVal stCommandText As String, ByVal Params As
OleDbParameterCollection, ByVal dtOrig As DataTable) As Long
Dim cmdUpdate As New OleDbCommand(stCommandText, connData)
How do I set cmdUpdate parameters to the Params that I pass? Can't get it to
work.
Thanks
Vayse