Hi,
I have used the following code to add the feedback entered to the web form into a database.
The code works fine. But when I try to deleted thi statement
SqlCommandBuilder objcb = new SqlCommandBuilder(objDa);
I am getting an error I mean it is executing the else part.
Can any one tell me what is the use of SqlCommandBuilder?
protected void btnSubmit_Click(object sender, EventArgs e)
{
    if (txtName.Text.Trim() == "")
    {
        Response.Write("<script>alert ('Name Field cannot be left blank')</script>");
        return;            
    }
    if (txtFeedBack.Text.Trim() == "")
    {
        Response.Write("<script>alert('FeedBack Field cannot be left blank')</script>");
        return;
    }
    objSqlConnection.ConnectionString = connectionStringSetting;
    objSqlConnection.Open();
    try
    {
        SqlDataAdapter objDa = new SqlDataAdapter("select * from FeedBack", objSqlConnection);
        SqlCommandBuilder objcb = new SqlCommandBuilder(objDa);
        DataSet objDs = new DataSet("FeedBack");
        objDa.Fill(objDs, "FeedBack");
        DataRow dr = objDs.Tables["FeedBack"].NewRow();
        dr[1] = txtName.Text;
        dr[2] = txtAddress.Text;
        dr[3] = txtCity.Text;
        dr[4] = txtCountry.Text;
        dr[5] = txtEmail.Text;
        dr[6] = Convert.ToInt32(txtContactNo.Text);
        dr[7] = txtFeedBack.Text;
        objDs.Tables["FeedBack"].Rows.Add(dr);
        objDa.Update(objDs, "FeedBack");
        Response.Write("<script>alert('Your FeedBack has been submitted')</script>");
        objSqlConnection.Close();
    }
    catch (Exception)
    {
        Response.Write("<script> alert('Error on Page. Please try after sometime')</script>");
        objSqlConnection.Close();
    }
And is there any way to display the specific error messages like if an user enters a string value instead of Integer value it should display the message as 'Input String not entered in correct format?