The link below contains an explanation of my problem..
This seems to be a bind problem..
When I use the following code in .NET it works fine.
In the code below the input parameter company_name is added dynamically to
the SQL statement.
I would prefer to do this by using the parameters.add method.
Can anyone please help me resolve my problem?
----------------------------------------------------------------------------
-----------------
Private Sub fetch_data(ByVa l cutoff_id As Integer, Byval company_name as
String)
Dim mySQL As String = "select CT.* from H_CUTOFF_TRANS CT where CT.CUTOFF_ID
= ? and CT.COMPANY_NAME in " & company_name
Dim myCmd As New OleDbCommand(my SQL, objOleDbConn)
Dim adapter As New OleDbDataAdapte r
myCmd.Parameter s.Add("@CUTOFF_ ID", OleDbType.Integ er).Value = cutoff_id
adapter.SelectC ommand = myCmd
Try
adapter.Fill(my DS, "TEST")
Catch e As OleDbException
End Try
DataGrid1.DataS ource = myDS.Tables("TE ST")
DataGrid1.DataB ind()
End Sub
----------------------------------------------------------------------------
-----------------
This seems to be a bind problem..
When I use the following code in .NET it works fine.
In the code below the input parameter company_name is added dynamically to
the SQL statement.
I would prefer to do this by using the parameters.add method.
Can anyone please help me resolve my problem?
----------------------------------------------------------------------------
-----------------
Private Sub fetch_data(ByVa l cutoff_id As Integer, Byval company_name as
String)
Dim mySQL As String = "select CT.* from H_CUTOFF_TRANS CT where CT.CUTOFF_ID
= ? and CT.COMPANY_NAME in " & company_name
Dim myCmd As New OleDbCommand(my SQL, objOleDbConn)
Dim adapter As New OleDbDataAdapte r
myCmd.Parameter s.Add("@CUTOFF_ ID", OleDbType.Integ er).Value = cutoff_id
adapter.SelectC ommand = myCmd
Try
adapter.Fill(my DS, "TEST")
Catch e As OleDbException
End Try
DataGrid1.DataS ource = myDS.Tables("TE ST")
DataGrid1.DataB ind()
End Sub
----------------------------------------------------------------------------
-----------------