I wrote this like ,if any mistake is their, correct it and send
SqlConnection con = new SqlConnection("DataSource=WEBDEV1-PC;Initial Catalog=srinu;User Id=sa;Password=pftec");
SqlCommand cmd = new SqlCommand("select * from Approval_Matrix_Setup", con);
con.Open();
SqlDataReader dr= cmd.ExecuteReader();
while (dr.Read())
{
//answer
}
for all i need to get the full data of the table
in the Response.Write
Loading
Sanjeeb LenkaPosted Jul 30, 2013, 8:14 AM
As you are selecting all values from table better to show it in a tabular format. if you response.Write it will only show one record . if you want to show all record using response.write it will increase the lines of code.
better to use gridview:
take a gridview in your aspx page then bind it to dr.
SqlConnection con = new SqlConnection("DataSource=WEBDEV1-PC;Initial Catalog=srinu;User Id=sa;Password=pftec");
SqlCommand cmd = new SqlCommand("select * from Approval_Matrix_Setup", con);
con.Open();
SqlDataReader dr= cmd.ExecuteReader();
while (dr.Read())
{
Gridview1.DataSource=dr;
Gridview1.DataBind();
}
con.Close();