Example #1
0
    protected void dctGRIDVIEW_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string updateSQL;

        updateSQL  = "UPDATE clinic_dentist set ";
        updateSQL += "dentist_name=:dentist_name, designation=:designation, address= :address, ";
        updateSQL += " telephone= :telephone, doct_startdate= :doct_startdate, doct_enddate= :doct_enddate ";
        updateSQL += "WHERE dentist_id=:dentist_id ";

        OracleConnection con = new OracleConnection(connectionString);
        OracleCommand    cmd = new OracleCommand(updateSQL, con);

        cmd.Parameters.Add(":dentist_name", e.NewValues[0].ToString());
        cmd.Parameters.Add(":designation", e.NewValues[1].ToString());
        cmd.Parameters.Add(":address", e.NewValues[2].ToString());
        cmd.Parameters.Add(":telephone", Int64.Parse(e.NewValues[3].ToString()));
        cmd.Parameters.Add(":doct_startdate", Convert.ToDateTime(e.NewValues[4].ToString()));
        cmd.Parameters.Add(":doct_enddate", Convert.ToDateTime(e.NewValues[5].ToString()));
        cmd.Parameters.Add(":dentist_id", Int64.Parse(DctGRIDVIEW.Rows[e.RowIndex].Cells[3].Text));
        // Try to open database and execute the update.
        int updated = 0;

        try
        {
            con.Open();
            updated         = cmd.ExecuteNonQuery();
            editresult.Text = updated.ToString() + " record updated.";
        }
        catch (Exception err)
        {
            errresult.Text  = "Error updating author. ";
            errresult.Text += err.Message;
        }
        finally
        {
            con.Close();
        }
        DctGRIDVIEW.EditIndex = -1;
        DctGRIDVIEW.DataBind();
    }
Example #2
0
 private void BindData()
 {
     DctGRIDVIEW.DataSource = Session["clinic_dentist"];
     DctGRIDVIEW.DataBind();
 }