This is my search button code. but it give error.
I enter custormer id and click search button it give this error "The text command text has not been properly intialized"
and again I click on search button. that time it show correct data row.
but again I entered new custormer id and click search button. it show early result. again when I click on search button it show correct data entry. this is my code:
Try
con.Open()
Using cmd = New MySqlCommand(Query, con)
Query = "select first_name,last_name,NIC_NO,c_address1,c_address2,c_address3,c_telephoneNO,membership_date,business_name,g_name,g_nicno,g_address1,g_address2,g_address3,g_telephoneNO from custormer where custormer_id='" & txtcustormerids.Text & "'"
dr = cmd.ExecuteReader()
While dr.Read()
Me.txtfirstnames.Text = Convert.ToString(dr("first_name"))
Me.txtlastnames.Text = Convert.ToString(dr("last_name"))
Me.txtnicnos.Text = Convert.ToString(dr("NIC_NO"))
Me.txtcaddress1s.Text = Convert.ToString(dr("c_address1"))
Me.txtcaddress2s.Text = Convert.ToString(dr("c_address2"))
Me.txtcaddress3s.Text = Convert.ToString(dr("c_address3"))
Me.txtctelephonenos.Text = Convert.ToString(dr("c_telephoneNO"))
Me.txtmembershipdates.Text = Convert.ToString(dr("membership_date"))
Me.txtbusinessnames.Text = Convert.ToString(dr("business_name"))
Me.txtgnames.Text = Convert.ToString(dr("g_name"))
Me.txtgnicnos.Text = Convert.ToString(dr("g_nicno"))
Me.txtgaddress1s.Text = Convert.ToString(dr("g_address1"))
Me.txtgaddress2s.Text = Convert.ToString(dr("g_address2"))
Me.txtgaddress3s.Text = Convert.ToString(dr("g_address3"))
Me.txtgtelephonenos.Text = Convert.ToString(dr("g_telephoneNO"))
End While
dr.Close()
cmd.Dispose()
con.Close()
End Using
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
End Try
please help me guys :)