private void Btn_Save_Click(object sender, EventArgs e)
{
try
{
for (int i = 0; i < DGV_Fac_SMS.RowCount; i++)
{
sql = "insert into Tb_Faculty_Schedule_Timetable [Name],[Mobile No],[Message]";
sql = sql + " values ( '" + (DGV_Fac_SMS.Rows[i].Cells[0].Value.ToString()) + "','" + (DGV_Fac_SMS.Rows[i].Cells[1].Value.ToString()) + "','" + (DGV_Fac_SMS.Rows[i].Cells[2].Value.ToString()) + "')";
GFun.Error = " ";
GFun.InsertAccessData(sql);
if (GFun.Error.ToString() != "")
{
MessageBox.Show(GFun.Error.ToString(), "Error");
//this.Cursor = Cursors.Arrow;
return;
}
GFun.OleDbCon.Close();
MessageBox.Show("Record Inserted Successfully", "Records Inserted", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show("Error", ex.ToString());
return;
}
}
when i click the save button error shows as follows;
syntax error in insert into statement.
what is my problem, in my insert code.
please help me.