narasiman rao

narasiman rao

  • NA
  • 519
  • 768.9k

i am inserting the record in the database but it is not save

Dec 25 2012 6:36 AM
code as follows;
 
private SqlDataCon SCon = new SqlDataCon();
private SqlDataReader Dr;
 
insert code as follows;
protected void Button1_Click(object sender, EventArgs e)
    {
        Label6.Text = "";
 
        if (FromDate.SelectedDateValue.ToString() == "")
        {
            Label6.Text = "From date is not selected";
            return;
        }
        if (Todate.SelectedDateValue.ToString() == "")
        {
            Label6.Text = "To date is not selected";
            return;
        }
 
            Sql = "insert into BirthDayWish values('" + txt_name.Text + "','" + FromDate.SelectedDateValue.ToString() + "','" + txt_mobile.Text + "','" + Todate.SelectedDateValue.ToString() + "','a','" + txt_Email.Text + "')";
            try
            {
            Dr = SCon.ReadSql(Sql);
            //GridView1.DataSource = Dr;
            //GridView1.DataBind();
            Dr.Close();
        }
 
        catch (Exception Ex1)
        {
            Response.Write(Ex1);
        }
    }
 
but is not saving in the database why>

Answers (1)