title: How to retrieve image in database to webform
body: <p>i am building a social network site using asp.net c# , And i am having a problem with retrieving image, when i upload an image to the database it name will be changed and it save on real path i mentioned.And also i want to say it saves in database as name of its .but i cannot link it to the webform. </p>
  
  <p>html code </p>
  
  <pre><code>&lt;asp:Image ID="Pro_pic" runat="server" Height="233px" ImageUrl="~/Profile/Image/Default.png" style="margin-left: 8px; margin-top: 13px" Width="187px" /&gt;
  </code></pre>
  
  <p>This is code behind file</p>
  
  <pre><code> protected void Page_Load(object sender, EventArgs e)
  {
  
  
  
  
  
  
          string db = "";
          db = ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString;
          SqlConnection con = new SqlConnection(db);
          con.Open();
          SqlCommand cmd = new SqlCommand();
          cmd.CommandText = "SELECT * FROM [UserData] WHERE Email = '" + Session["Email"].ToString() + "'";
          cmd.Connection = con;
          SqlDataReader dr;
          dr = cmd.ExecuteReader();
  
          while (dr.Read())
          {
  
              Pro_pic.ImageUrl = @"C:\Users\Supun\Documents\Visual Studio 2013\WebSites\MeetYou\ProfilePic\"+dr["ProfilePic"];
  
          }
  
          con.Close();
  
  
  
  
  
  
  
  }
  </code></pre>
  
  <p>And this is sql code</p>
  
  <pre><code>CREATE TABLE [dbo].[UserData] (
  [YourName]    VARCHAR (50)  NULL,
  [Email]       VARCHAR (50)  NOT NULL,
  [Password]    VARCHAR (50)  NULL,
  [Gender]      VARCHAR (50)  NULL,
  [Birthday]    VARCHAR (50)  NULL,
  [AboutMe]     VARCHAR (50)  NULL,
  [Country]     VARCHAR (50)  NULL,
  [ID]          NVARCHAR (50) NOT NULL,
  [ProfilePic ] NVARCHAR (500)       NULL,
  CONSTRAINT [PK_UserData] PRIMARY KEY CLUSTERED ([Email] ASC)
  </code></pre>
  
  <p>);</p>
  
  <p>Could someboday tell me how to get this image URL properly???</p>
  
  <p>I think error on this </p>
  
  <pre><code>Pro_pic.ImageUrl = @"C:\Users\Supun\Documents\Visual Studio 2013\WebSites\MeetYou\ProfilePic\"+dr["ProfilePic"];
  </code></pre>