forum

Home / DeveloperSection / Forums / Duplicate Values are inserted into database using DatagidView

Duplicate Values are inserted into database using DatagidView

Jayden Bell 1549 23-Dec-2013

Duplicate Values are inserted into database using DatagidView

foreach (DataGridViewRow dgRow in dataGridView1.Rows)
                {
                    if (dgRow.Cells[0].Value != null)
                    {
                        string re1 = dgRow.Cells[0].Value.ToString();
                        string strQuery1 = "INSERT INTO unit_master(unit) VALUES('" + re1 + "')";
                        SqlCommand scmd1 = new SqlCommand(strQuery1,SqlConn);
                        scmd1.ExecuteNonQuery();
                    }
                }

How to resolve it?


c# c# 
Updated on 30-Sep-2014

Can you answer this question?


Answer

2 Answers

Liked By