I have a data grid from which i got the values from a CSV file,im trying to validade each row of the grid before inserting it to my database.
I want to check if a specific row of the Grid contains null values or special character if not then insert that specific row.
My problem is my first if condition that is not returning any error possible
for(int i=0;i<=da.Tables["Stocks"].Rows.Count-1;i++)
{
if (row is null)
{
MessageBox.Show("message of row containing wrong character or null");
}
else
{
//insert into database
cmd.CommandText = "Insert into Test values('" + da.Tables["data"].Rows[i].ItemArray.GetValue(0) + "','" + da.Tables["data"].Rows[i].ItemArray.GetValue(1) + "','" + da.Tables["data"].Rows[i].ItemArray.GetValue(2) + "')";
cmd.ExecuteNonQuery();
}
}