SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=PROMOD-PC;Initial Catalog=travel_Directions;Integrated Security=True"; SqlCommand scmd1 = null; SqlDataAdapter sDatAdp = new SqlDataAdapter(); String selQuery = "SELECT Id FROM MapDataImage WHERE Source='" + TextBox1.Text + "';"; { SqlCommand scmd = new SqlCommand(selQuery, con); con.Open(); SqlDataReader sqldread = scmd.ExecuteReader(); while (sqldread.Read()) { int Dbid = (int)sqldread["Id"]; Label4.Text = Convert.ToString(Dbid); if (Dbid != null) { String QueryStr = "SELECT Image FROM User_Images WHERE Id='" + Dbid + "'"; scmd1 = new SqlCommand(QueryStr, con); } } sqldread.Dispose(); //scmd1.CommandType = CommandType.Text; //scmd1.Connection = con; SqlDataReader dr = scmd1.ExecuteReader(); dr.Read(); Context.Response.BinaryWrite((byte[])dr["Image"]); Context.Response.ContentType = "image/jpg"; sDatAdp.SelectCommand = scmd1; GridView1.DataSource = dr; GridView1.DataBind(); con.Close(); dr.Close(); sDatAdp.Dispose(); con.Dispose(); }
String QueryStr = "SELECT Image FROM User_Images WHERE Id='" + Dbid + "'";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)