I have solved the issue about the sub running twice. It was because I
added an 'OnTextChanged' event for my textbox, which called the sub.
So when I clicked on the submit button, the sub was called from the
textbox as well as from the submit button. I am now using the Panel
object to set the default button to the submit button, so that when
the user hits the enter button, the submit button is activated.
<asp:Panel ID="LoginPanel" runat="server"
DefaultButton="btn_submit">
<asp:TextBox id="search_part_no" runat="server" />
<asp:Button id="btn_submit" OnClick="Submit_Search" Text=search
Style="font: 12pt Arial;" runat="server" />
</asp:panel>
My remaining problem now is the similar matching thing. The following
line of code does not run into any errors, but it does not match any
data from the database.
Dim str_search = New String("SELECT id, part_no, cust_part_no,
customer FROM table1 WHERE part_no LIKE '%...@input_part_no%' ")
Dim sqlComm As New MySqlCommand(str_search,myConnection)
sqlComm.Parameters.AddWithValue("@input_part_no",
search_part_no.Text)
Where search_part_no.Text is the text in my search box, entered by the
user.
Thanks,
Helvin