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

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -