parameters.add in .NET (Bind problems?)

From: Gunnar Idsal <gunnaridsal_at_hotmail.com>
Date: 26 Sep 2003 10:44:31 +0200
Message-ID: <3f73fc6b$1_at_news.wineasy.se>


The link below contains an explanation of my problem..

http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=347883

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(ByVal 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(mySQL, objOleDbConn)

Dim adapter As New OleDbDataAdapter

myCmd.Parameters.Add("_at_CUTOFF_ID", OleDbType.Integer).Value = cutoff_id

adapter.SelectCommand = myCmd

Try

adapter.Fill(myDS, "TEST")

Catch e As OleDbException

End Try

DataGrid1.DataSource = myDS.Tables("TEST")

DataGrid1.DataBind()

End Sub



Received on Fri Sep 26 2003 - 10:44:31 CEST

Original text of this message