Hi,
Using your suggestion gives an error at the ExecuteReader line. I
don't understand why...
btw, I am now using dataReader fine! =)
I have another issue, where my sub which is included below runs twice.
When I hit the submit button, this sub, 'submit_search' is called
twice.
Sub Submit_Search(ByVal obj As System.Object, ByVal e As
System.EventArgs) 'Handles btn_submit.Click
Using myConnection As New MySqlConnection("server=localhost; user
id=myuser; database=database1; pooling=false;")
Dim str_search = New String("SELECT id, part_no, cust_part_no,
customer FROM table1 WHERE part_no = @input_part_no")
Dim sqlComm As New MySqlCommand(str_search, myConnection)
sqlComm.Parameters.AddWithValue("@input_part_no",
search_part_no.Text)
Dim dr As MySqlDataReader
myConnection.Open()
sqlComm.Connection = myConnection
sqlComm.CommandText = str_search
dr = sqlComm.ExecuteReader
'(CommandBehaviour.CloseConnection);
'This while loop outputs the row of data found from the
database
While dr.Read
Dim id_found
Dim r As New TableRow()
Dim c As New TableCell()
Dim Lbl, Lbl_cust_part_no, Lbl_customer As New label()
Dim Lbl_pcl, Lbl_ecn As New LinkButton()
Dim strSQL As String
label_state.Text = dr.GetValue(0).ToString
id_found = dr.GetValue(0).ToString
Lbl.Text = dr.GetValue(1).ToString
c.Controls.Add(Lbl)
r.Cells.Add(c)
<some more cells...>
Table1.Rows.Add(r)
End While
myConnection.Close()
End Using
End Sub