here session value is correct sql table is mapping with query, i have been written the code in page load for fetching into textboxes and i want update that data in updatebutton click was written code as fallows
but the details are not updating.am not getting what was the problem help me from this.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class update : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["matrimonysite"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("select Fullname,Surname,Religion,Caste,Email,MobileNo,Address,Maritalstatus,City,Height,Weight,Complexion,Bloodgroup,Qualification,Workingin,Salary from Registration where Username='"+Session["User1"].ToString()+"' ", con);
SqlDataReader dr;
con.Open();
dr = cmd.ExecuteReader();
dr.Read();
txtId.Text = Session["USER1"].ToString();
txtFullName.Text = dr[0].ToString();
txtSurname.Text = dr[1].ToString();
txtReligion.Text = dr[2].ToString();
txtGotra.Text = dr[3].ToString();
txtEmail.Text = dr[4].ToString();
txtAddress.Text = dr[6].ToString();
txtMobile.Text = dr[5].ToString();
txtMaritalstatus.Text = dr[7].ToString();
txtCity.Text = dr[8].ToString();
txtHeight.Text = dr[9].ToString();
txtWeight.Text = dr[10].ToString();
txtComplexion.Text = dr[11].ToString();
txtBloodgroup.Text = dr[12].ToString();
txtQualification.Text = dr[13].ToString();
txtWorkingin.Text = dr[14].ToString();
txtSalary.Text = dr[15].ToString();
con.Close();
}
protected void txtId13_TextChanged(object sender, EventArgs e)
{
}
protected void txtId_TextChanged(object sender, EventArgs e)
{
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
SqlCommand cmd1 = new SqlCommand("update Registration set Fullname='"+txtFullName.Text+"',Surname='"+txtSurname.Text+"',Religion='"+txtReligion.Text+"',Caste='"+txtGotra.Text+"',Email='"+txtEmail.Text+"',MobileNo='"+txtMobile.Text+"',Address='"+txtAddress.Text+"',Maritalstatus='"+txtMaritalstatus.Text+"',City='"+txtCity.Text+"',Height='"+txtHeight.Text+"',Weight='"+txtWeight.Text+"',Complexion='"+txtComplexion.Text+"',Bloodgroup='"+txtBloodgroup.Text+"',Qualification='"+txtQualification.Text+"',Workingin='"+txtWorkingin.Text+"',Salary='"+txtSalary.Text+"' where Username='"+Session["user1"].ToString()+"'", con);
con.Open();
cmd1.ExecuteNonQuery();
con.Close();
Response.Write("<script>alert('Your Details have been updated ')</script>");
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Session.Abandon();
}
}