protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string connetionString; SqlConnection cnn; connetionString = @"Data Source=DESKTOP-NCLVKS1;Initial Catalog=E-Employment ;User ID=sa;Password=allohomora"; String sql; cnn = new SqlConnection(connetionString); SqlCommand command; cnn.Open(); sql = "Select * from State"; command = new SqlCommand(sql, cnn); SqlDataAdapter sda = new SqlDataAdapter(command); DataTable dt = new DataTable(); sda.Fill(dt); DDLState.DataSource = dt; DDLState.DataTextField = "Name"; DDLState.DataValueField = "Id"; DDLState.DataBind(); DDLState.Items.Insert(0, new ListItem("Select", "0".ToString())); sql = "Select * from Degree"; command = new SqlCommand(sql, cnn); SqlDataAdapter sda1 = new SqlDataAdapter(command); DataTable dt1 = new DataTable(); sda1.Fill(dt1); DDLDegree.DataSource = dt1; DDLDegree.DataTextField = "Value"; DDLDegree.DataValueField = "Id"; DDLDegree.DataBind(); DDLDegree.Items.Insert(0, new ListItem("Select", "0".ToString())); sql = "Select * from JobSeeker where username=@user"; command = new SqlCommand(sql, cnn); command.Parameters.AddWithValue("@user", Session["Username"]); SqlDataAdapter sda2 = new SqlDataAdapter(command); DataTable dt2 = new DataTable(); sda1.Fill(dt2); FNTB.Text = dt2.Rows[0]["First Name"].ToString(); LNTB.Text = dt2.Rows[0]["Last Name"].ToString(); AddrTB.Text = dt2.Rows[0]["Address"].ToString(); PinTB.Text = dt2.Rows[0]["Pincode"].ToString(); ResumeTB.Text = dt2.Rows[0]["Resume"].ToString(); CertificateTB.Text = dt2.Rows[0]["Certificate"].ToString(); cnn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string connetionString; SqlConnection cnn; connetionString = @"Data Source=DESKTOP-NCLVKS1;Initial Catalog=E-Employment ;User ID=sa;Password=allohomora"; String sql; cnn = new SqlConnection(connetionString); SqlCommand command; cnn.Open(); sql = "Select * from State"; command = new SqlCommand(sql, cnn); SqlDataAdapter sda = new SqlDataAdapter(command); DataTable dt = new DataTable(); sda.Fill(dt); DDLState.DataSource = dt; DDLState.DataTextField = "Name"; DDLState.DataValueField = "Id"; DDLState.DataBind(); DDLState.Items.Insert(0, new ListItem("Select", "0".ToString())); DDLState0.DataSource = dt; DDLState0.DataTextField = "Name"; DDLState0.DataValueField = "Id"; DDLState0.DataBind(); DDLState0.Items.Insert(0, new ListItem("Select", "0".ToString())); sql = "Select * from Degree"; command = new SqlCommand(sql, cnn); SqlDataAdapter sda1 = new SqlDataAdapter(command); DataTable dt1 = new DataTable(); sda1.Fill(dt1); DDLDegree.DataSource = dt1; DDLDegree.DataTextField = "Value"; DDLDegree.DataValueField = "Id"; DDLDegree.DataBind(); DDLDegree.Items.Insert(0, new ListItem("Select", "0".ToString())); cnn.Close(); } }