1 year ago
#387016

Shabareesh k r
Reusing OLEDB parameters
How do we create a named parameter in OLEDB? I have a complex query and using ? as parameter does not serve my purpose since I will be reusing the parameter in the union statement of the query. How can we address the issue of reusing the same parameter multiple times in the same query. I am using .net v2.0 framework vb.net, and connecting to SQL server via sqloledb provider and OLEDB driver. Sample code attached
Public Function ExecuteGetDatasetChild(ByVal commandstring As String) As System.Data.DataSet Implements IDBHelper.ExecuteGetDataset
Dim theAdapter As OleDbDataAdapter = New OleDbDataAdapter(commandstring, theConnection)
Dim theData As System.Data.DataSet = New DataSet
theData.ExtendedProperties.Add("commandstring", commandstring)
theAdapter.SelectCommand.CommandTimeout = commandTimeout
'theAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
theAdapter.Fill(theData, "defaultTable")
Return (theData)
End Function
c#
ado.net
oledb
0 Answers
Your Answer