Click here to Skip to main content
15,936,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Sir I want to stored data into database and show this Data on my web page. Firstly I am stored data into database (Sql Server 2005)which i done.But I have some problem to retrieving data on webpage. Can u help me.


You could start with some tutorials on DB access here[^].
Share this answer
void BindGridView()
{ SqlConnection con = new SqlConnection("server=WASIF\\SQLEXPRESS;database=HRMS;integrated security=true");

SqlCommand cmd = new SqlCommand("select * from abc", con);
SqlDataReader dtr = cmd.ExecuteReader();
if (dtr.Read())
GridView1.DataSource = dtr;
On page Load Event call this function as
if (!IsPostBack)
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900