c# - Reader cannot continue after i've checked for records -
I have successfully checked that values in the database are true.
Here is the code:
if (! Reader.Read ()) {MessageBox.Show ("user can not be found!"); Reader.Close (); } And {int count = 0; While (reader.Read ()) {string user = (string) reader.GetString (0); String Name = (string) Reader. GestString (1); Int roll = (Int) Reader GetInt 32 (2); String Phone = (String) Reader. GestString (3); String address = (string) reader. Gastestring (4); String birthflow = (string) reader. Gesture string (5); Label1.Text = "" + Roll; Label2.Text = Name; Label 3 Text = postnatal; Label4.Text = "" + Phone; Label5.Text = Address; }} But the problem is that whenever the loop is dropped.
Change if (! Reader.Read ()) < / Code> with
if (! Reader .hasRows)
Comments
Post a Comment