471,108 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,108 software developers and data experts.

parameters.add in .NET (Bind problems?)

The link below contains an explanation of my problem..

http://www.asp.net/Forums/ShowPost.a...&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("@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

----------------------------------------------------------------------------
-----------------

Jul 19 '05 #1
0 3142

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Dmitry Bond. | last post: by
reply views Thread by user | last post: by
reply views Thread by Mike P | last post: by
reply views Thread by Gunnar Idsal | last post: by
3 posts views Thread by Giovanni Gherdovich | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.