When I type in datagridview textbox next row automatically generated.
How to stop that ?
When I clicked on Insert button empty row also store in database that is why I'm asking how to stop automatically row generate ?
I want only text ROW will be store in database, null or empty row does not store in database ??
string StrQuery;
using (SqlConnection conn = new SqlConnection(connection string))
{
using (SqlCommand comm = new SqlCommand())
{
comm.Connection = conn;
conn.Open();
for(int i=0; i< dataGridView1.Rows.Count;i++)
{
StrQuery= @"INSERT INTO std VALUES ('"
+ dataGridView1.Rows[i].Cells["sname"].Value +"', '"
+ dataGridView1.Rows[i].Cells["class"].Value +"')";
comm.CommandText = StrQuery;
comm.ExecuteNonQuery();
}
}
}