Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
i'm having a problem, in displaying the image in the imagebox. i'm having the following fields in my table User:
1 user name
2 email- primary key
3 age
4 password
5 image_name
6 image_path
and the folder in which the image is saved named - User_Pic.
 
now, i have saved the image name and path in the database using the following code:
FileUpload.PostedFile.SaveAs(Server.MapPath("~/User_Pic/") + FileUpload.FileName.ToString());
string Filename = Path.GetFileName(FileUpload.PostedFile.FileName);
 
string sql = "insert into User_Table values('" + txtUser_Name.Text + "','" + txtEmail_Id.Text + "','" +  txtAge.Text + "','" + txtPassword.Text + "','" + Filename + "','" + "User_Pic/"+Filename + "')";
 
ob.cmd = new System.Data.SqlClient.SqlCommand(sql, ob.con);
ob.cmd.ExecuteNonQuery();
lblInfo.Text = "REGISTERED SUCCESSFULLY";
Now how to display it in image box using the query as email id:
string sql = "select Image_Path from User_Table where Email_Id = ('" + TextBox1.Text + "')";
after this i'm having the trouble ??
 
PLEASE HELP
Posted 21-Apr-13 0:06am
Edited 21-Apr-13 4:18am
v2
Comments
ThePhantomUpvoter at 21-Apr-13 5:43am
   
"after this i'm having the trouble", and what exactly would that trouble be?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

use
picturebox.ImageLocation="your_image_path";
and assign path to it!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,045
1 DamithSL 4,611
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 21 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100