First of all you have to create sql
connection with the database...
For this see the following link
Now you have to define one button
and textboxes as per your field in .aspx file. . .
now write the following code in
button click event...
You have to define SqlDataAdapter and DataTable.
protected void Button1_Click(object sender, EventArgs e)
{
{
con.open();
SqlDataAdapter adp = new SqlDataAdapter("select * from city where cityid='" + ct.Text + "'", con);
DataTable dt=new DataTable();
adp.fill(dt);
if(dt.Rows.Count>0)
{
TextBox1.Text=dt.Rows[0]["cityid"].toString();
TextBox2.Text=dt.Rows[1]["cityname"].toString();
}
con.close();
}
textboxces you have to take as per your filed and requirment. . .
hope it will help you....
Good Luck......
0 comments:
Post a Comment