parameters.add in .NET (Bind problems?)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gunnar Idsal

    parameters.add in .NET (Bind problems?)

    The link below contains an explanation of my problem..

    Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.


    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

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



Working...