I'm coding button which name 'Load'. I coded it like this,
Try Using cmd = New MySqlCommand(Query, con) Query = "SELECT first_name FROM custormer WHERE custormer_id='" & txtcustormeridforloanform.Text & "'" dr = cmd.ExecuteReader() While dr.Read() Me.txtcustormername.Text = Convert.ToString(dr("first_name")) cmd.ExecuteNonQuery() End While End Using Catch ex As Exception MessageBox.Show(ex.Message) End Try
I want to do this, there is text box name txtcustormer_id. If I type custormer id and click load button, I want to show custormer name to txtcustormer_name text box. but unfortunately firstly it give
The commandText property has not been properly initialized.
and after i click ok button on error message and again click load button it show correct custormer name. but second time I enter another custormer id and click load button. it show this error mesasge,
There is already an open datareader associated with this connection which must be closed first.
Can anyone help me ?