Goran Bibic

Goran Bibic

  • 482
  • 2.9k
  • 198.1k

Counter count to 10, end then 10,10,10,10,...at 1 to 9 is ev

Mar 14 2018 9:34 AM
Counter count to 10, end then 10,10,10,10,...at 1 to 9 is everithing is ok...
 
What is wrong
  1. SqlDataReader rdr;  
  2.                             SqlCommand cmd = new SqlCommand();  
  3.   
  4.   
  5.                             cmd.CommandText = "select max(brojprijavnice2) from dbo.prijava_radnika ";  
  6.                             cmd.Connection = con;  
  7.                             con.Open();  
  8.                             rdr = cmd.ExecuteReader();  
  9.                             int max = 0;  
  10.                             while (rdr.Read())  
  11.                             {  
  12.                                 max = Convert.ToInt32(rdr[0].ToString());  
  13.                                 Console.WriteLine(max);  
  14.   
  15.                             }  
  16.                             con.Close();  
  17.   
  18.   
  19.                             String updateStaff = "UPDATE [dbo].[prijava_radnika] SET [vrijemeodjave] = @vrijemeodjave, brojprijavnice2 = '" + (max+1) + "', [status] = 'odjavljen' WHERE radnik = '" + readerresultTextbox.Text + "' and [status] = 'prijavljen'"

Answers (7)