Design as follows;
Faculty Code Combo box
Month calendar (calendar Control)
in Datagridview as follows;
Seleck(checkbox) Dates
when i select the any month in the month calendar that month all dates is dispaly into the datagridivew.
using check box i select any of the date in the datagridview and save in the database.
For that my code as follows;
private void Btn_Save_Click(object sender, EventArgs e)
{
int i = 0;
if(Convert.ToString(DGVCalendar[1,i].Value) == "True")
{
sql = "insert into Tb_Faculty_Availability ([Faculty_code],[Available_date],)";
sql = sql + " values('" + cb_Faculty_Code.Text + "','" + Convert.ToDateTime(DGVCalendar.Rows[i].Cells[2].Value.ToString()) + "')";
try
{
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("Records Inserted Successfully", "Record Inserted", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception Ex)
{
MessageBox.Show(Ex.ToString(), "Error");
this.Cursor = Cursors.Arrow;
return;
}
}
}
when i click the save button the record is not saving in the database.
From my above code what is the problem.
Please help me.
Regards,
Narasiman P.