I have created a one form which consits of various fields.
this fields data i have succesfully saved in the database.
Now i have created one more form which consits of one drop down list.
i want drop down list should contain a primary key value,and after selecting a particular value value from dropdown list the whole details of that associated primary key should be display in the gridview.
This is what i have done in the first page.
In the following code stdid is a Primary key of the table.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class FillInformation : System.Web.UI.Page
{
SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con= new SqlConnection("server=SACHIN-5DDBFA03\\SACHIN;uid=sa;password=india;database=master");
con.Open();
SqlCommand cmd = new SqlCommand("insert into Students_Details values(@stdid,@sfname,@slname,@Maths,@Science,@SocialScience,@Address)",con);
cmd.Parameters.Add("@stdid",txtrollnumber.Text);
cmd.Parameters.Add("@sfname",txtfname.Text);
cmd.Parameters.Add("@slname",txtlname.Text);
cmd.Parameters.Add("@Maths", txtmath.Text);
cmd.Parameters.Add("@Science", txtscience.Text);
cmd.Parameters.Add("@SocialScience", txtsoscience.Text);
cmd.Parameters.Add("@Address",txtaddress.Text);
cmd.ExecuteNonQuery();
con.Close();
Response.Write("One Record Inserted Succesfully");
}
protected void next_Click(object sender, EventArgs e)
{
Response.Redirect("Students_Details.aspx");
}
}
can any 1 give coding for the second page.
Please give me easy solution as much as possible.