protected void Page_Load(object sender, EventArgs e) { con.ConnectionString = ConfigurationManager.ConnectionStrings["Assumption"].ConnectionString; con.Open(); SqlDataAdapter adr = new SqlDataAdapter("select image_path from gallery", con); DataTable dt = new DataTable(); adr.Fill(dt); RptGal.DataSource = dt; RptGal.DataBind(); string a = dt.Rows[0][0].ToString(); con.Close(); }
protected void Page_Load(object sender, EventArgs e) { con.ConnectionString = @"Data Source=WELCOME\SQLEXPRESS;Initial Catalog=charity;User ID=sa;Password=admin123"; con.Open(); //SqlCommand cmd = new SqlCommand("select Image_path from Gallery", con); SqlDataAdapter rdr = new SqlDataAdapter("select Image_path from Gallery", con); DataTable dt = new DataTable(); rdr.Fill(dt); RptGal.DataSource = dt; RptGal.DataBind(); string a = dt.Rows[0][0].ToString(); //mage2.ImageUrl = a; con.Close(); }