How about instead of: part_no LIKE '%...@input_part_no%' try part_no LIKE '%' + @input_part_no + '%'
On Jan 21, 1:22 am, Helvin <[email protected]> wrote: > This time, I tried testing whether or not the variable @input_part_no > is taking on the string in search_part_no.Text, ie, the string input > at the search box. I made the text of a label on my asp.net page = > myDA.SelectCommand.Parameters("@input_part_no").Value > > And indeed whatever I enter in the search box, the label shows the > same! Yet the database does not find it. strange... > > Using myDA As New MySqlDataAdapter(str_search, myConnection) > myDA.SelectCommand.CommandType = CommandType.Text > myDA.SelectCommand.Parameters.AddWithValue("@input_part_no", > search_part_no.Text) > label_state.Text = myDA.SelectCommand.Parameters > ("@input_part_no").Value > Using myDataSet As New Dataset() > myDA.Fill(myDataset, "table1") > MySQLDataGrid.DataSource = myDataSet.Tables("table1") > MySQLDataGrid.DataBind() > End Using > End Using > > Then I tried changing the sql statement so that it searches for an > exact match. > Dim str_search = New String("SELECT part_no, cust_part_no, > customer FROM table1 WHERE part_no = @input_part_no;") > > This works! It finds the exact part number. But I do want to implement > it so that the user does not have to type in the part number exactly. > So that they can find it even with a partial part number.
