If type value non bar code active is line 49 and no have problems multiple times...
Whene coplue times wrong bar code value I have error line 25 on code
If is bar code from database ok working fine, if is bar code not ok firs time is ok, if wronf two times bar code errorr...
Error is INVALID ATTEMP TO READ WHEN NO DATA IS PRESENT
- private void prijavaAction()
- {
- SqlConnection con = new SqlConnection(cs);
- if (textBox1.Text.All(char.IsDigit))
- {
string queryString = "SELECT [ime_prezime] FROM dbo.radnici WHERE bar_kod = '" + textBox1.Text + "'"; - using (SqlConnection connection = new SqlConnection(cs))
- {
- SqlCommand command = new SqlCommand(queryString, connection);
- connection.Open();
- SqlDataReader reader = command.ExecuteReader();
- try
- {
- if (reader.Read())
- {
- notificationPanel.BackColor = System.Drawing.ColorTranslator.FromHtml("#2EFF36");
- messageLabel.Text = (reader["ime_prezime"].ToString()) + " je prijavljen u \n " + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss");
- readerresultTextbox.Text = (reader["ime_prezime"].ToString());
- }
- else
- {
- notificationPanel.BackColor = System.Drawing.ColorTranslator.FromHtml("#FD7400");
- messageLabel.Text = "Radnik ne postoji u bazi! \nProverite vašu karticu ili probajte ponovo!";
- textBox1.Text = "";
- }
- }
- finally
- {
- if (reader.Read())
- {
- //Insert into
- }
- else
- {
- //update
- }
- reader.Close();
- }
- }
- }
- else
- {
- notificationPanel.BackColor = System.Drawing.ColorTranslator.FromHtml("#FD7400");
- messageLabel.Text = "Bar kod nije važeci ili nije bar kod";
- textBox1.Text = "";
- }
- }
Rafnas T PPosted Apr 4, 2018, 2:24 AM
Goran BibicPosted Apr 4, 2018, 3:56 AM
Goran BibicPosted Apr 4, 2018, 3:50 AM
Goran BibicPosted Apr 4, 2018, 3:46 AM
Rafnas T PPosted Apr 4, 2018, 3:38 AM
Rafnas T PPosted Apr 4, 2018, 3:35 AM
Goran BibicPosted Apr 4, 2018, 3:32 AM
Goran BibicPosted Apr 4, 2018, 3:26 AM
Goran BibicPosted Apr 4, 2018, 3:23 AM
Rafnas T PPosted Apr 4, 2018, 2:46 AM
Rafnas T PPosted Apr 4, 2018, 2:40 AM
Goran BibicPosted Apr 4, 2018, 2:39 AM
Goran BibicPosted Apr 4, 2018, 2:34 AM
Rafnas T PPosted Apr 4, 2018, 2:26 AM
Goran BibicPosted Apr 4, 2018, 2:25 AM
Rafnas T PPosted Apr 4, 2018, 2:10 AM
Goran BibicPosted Apr 4, 2018, 1:52 AM
Rafnas T PPosted Apr 4, 2018, 1:47 AM
Goran BibicPosted Apr 4, 2018, 1:42 AM
Removeed...first time ok...another time same error
Rafnas T PPosted Apr 4, 2018, 1:32 AM
Goran BibicPosted Apr 3, 2018, 11:07 AM
Rafnas T PPosted Apr 3, 2018, 10:50 AM
Goran BibicPosted Apr 3, 2018, 10:44 AM
Goran BibicPosted Apr 3, 2018, 10:40 AM
Rafnas T PPosted Apr 3, 2018, 5:02 AM
Rafnas T PPosted Apr 3, 2018, 4:59 AM