for (int i = 0; i < datagridView.RowCount; i++)
{
for (int j = 2; j < datagridView.ColumnCount; j++)
{
if (datagridView[j, i].Value.ToString().Contains(","))
{
string strvalue = datagridView[j, i].Value.ToString() + ", " + cb_Course.Text;
string[] strarray = strvalue.Split('/');
foreach(object obj in strarray)
{
}
}
}
}
when i run the above code and save in the database.
record not saving what is the problem in my above code
My insert query as follows;
sql = "insert into Tb_SCh_TIme_Table([Sch_Date], [Session], [Course],[Faculty_Code])" + " values ('" + Convert.ToDateTime(datagridView.Rows[i].Cells[0].Value.ToString()) + "', " + int.Parse(datagridView.Rows[i].Cells[1].Value.ToString()) + ", '" + datagridView[j, i].Value.ToString() + "','" + datagridView.Columns[j].HeaderText.ToString() + "')";
what is the problem in my code , when i run in the datagridview two values are there in a cell as follows
REO,MFA
i want to split and save in the database.