Some help
In line 10 setup IsLetterOrDigit..
When add some value in datagrid
Line 34-39 have problem...
Every time add new row, if put number it ok kolicina (quantity go up +1), if is bar code type vm1403 add new row...not kolicina (quantity) +1...why? Some help?
- int cqty = Convert.ToInt32(row.Cells["kolicina"].Value) + 1;
-
- if (textBox1.Text == row.Cells["bar_kod"].Value.ToString())
- {
- row.Cells["kolicina"].Value = cqty;
- private void prijavaAction()
- {
- PullData();
-
-
- int sno = dataGridView1.Rows.Count + 1;
-
- SqlConnection con2 = new SqlConnection(con);
-
- if (textBox1.Text.All(char.IsLetterOrDigit))
-
- {
- string queryString = "select [bar_kod], [naziv], [cijena_sa_porezom] from dbo.roba_usluge WHERE [bar_kod] = '" + textBox1.Text + "'";
- using (SqlConnection connection = new SqlConnection(con))
- {
- SqlCommand command = new SqlCommand(queryString, connection);
- connection.Open();
- SqlDataReader reader = command.ExecuteReader();
-
- /////////////////////////////////
- errorr var itemAndPrice = textBox1.Text;
-
- var SingleRow = (from Rows in dataGridView1.Rows.Cast() where !Rows.IsNewRow && Rows.Cells["bar_kod"].Value.ToString().ToUpper() == textBox1.Text.ToUpper() select Rows).FirstOrDefault();
-
-
- if (reader.Read())
- {
-
- bool barcodeexist = false;
- foreach (DataGridViewRow row in dataGridView1.Rows)
- {
- int cqty = Convert.ToInt32(row.Cells["kolicina"].Value) + 1;
-
- if (textBox1.Text == row.Cells["bar_kod"].Value.ToString())
- {
- row.Cells["kolicina"].Value = cqty;
- ////////////////////////////////
- foreach (DataGridViewRow g1 in dataGridView1.Rows)
- {
-
-
- g1.Cells["ukupno"].Value = (Convert.ToDouble(g1.Cells["kolicina"].Value) * Convert.ToDouble(g1.Cells["cijena"].Value)).ToString("0.00");
-
- }