Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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;

C#
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.
Posted
Updated 8-Mar-13 2:05am
v2
Comments
Menon Santosh 8-Mar-13 8:08am    
to solve this problem you have to set a breakpoint and check where is the problem
Maciej Los 8-Mar-13 14:45pm    
MS Access database???
Where it is placed?
Sergey Alexandrovich Kryukov 8-Mar-13 23:15pm    
Not a question.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900