Only thing I can think of is that maybe MySQL handles parameters
differently - never used MySQL myself, so I don't know for sure.  You
may want to look into that - maybe the @varname syntax isn't right for
MySQL - you should be able to find examples out there of using
parameters with MySQL, to make sure your syntax is right.

Aside from that, if you have a database administration tool that
allows you to monitor statements as they are executed (like SQL
Trace), give that a shot - it should show you the statement being
fired, and you can copy/paste that into your SQL editor and try to run
and see what you get.

On Jan 20, 8:04 pm, Helvin <[email protected]> wrote:
> I changed my code to:
>
>     Using myDA As New MySqlDataAdapter(str_search, myConnection)
>       myDA.SelectCommand.Parameters.AddWithValue("input_part_no",
> "partno2")
>       Using myDataSet As New Dataset()
>           myDA.Fill(myDataset, "table1")
>           MySQLDataGrid.DataSource = myDataSet.Tables("table1")
>           MySQLDataGrid.DataBind()
>         End Using
>      End Using
>
> It still does not work. The 2nd line of code above shows me hardcoding
> a value, partno2, into the variable input_part_no.
> I know that partno2 exists in the database, but its not finding it.
> Maybe input_part_no is not taking on the value (partno2) that I give
> it?
>
> Once again, if I do not use parametized statements, and use this line
> of code instead:
>          Dim str_search = New String("SELECT part_no, cust_part_no,
> customer FROM table1 WHERE part_no LIKE '%partno2%'")
> The right data is found. However, I don't want to hardcode, because I
> want to be able to search from the database, whatever the user enters
> into the search box.
>
> Any help appreciated.
>
> Helvin

Reply via email to