Tuesday, January 26, 2010

Use Of Data Reader / Get data from the Table using data Reader

SqlDataReader dr1;
conn.Open();
string strquery1 = “select * from tbl_test where id= ‘” + Request.Params.Get(“id”) + “‘”;
SqlCommand cmd2 = new SqlCommand(strquery1, conn);
dr1 = cmd2.ExecuteReader();
if (dr1.Read())
{
filename1 = dr1["categoryphoto"].ToString();
//filename2 = dr1["photopathbig"].ToString();
}
dr1.Close();