TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kevin Fralick
NA
21
11.3k
Query image from database, and save to local?
Jan 25 2012 11:55 AM
Hi all,
I'm querying an email address and an image field. I need to save the image field to my local where the name is in the form of
<email address>.jpeg.
I think some conversion is necessary through Bitmap. I've never done this before and am having problems with it. If you could tell me what I'm doing wrong, I would greatly appreciate it.
SqlCommand
query =
new
SqlCommand
(
"SELECT a.email, b.image01 from empmast a, picture b where a.perno = b.perno"
);
query.Connection = con;
SqlDataAdapter
mysqldataadapter =
new
SqlDataAdapter
();
mysqldataadapter.SelectCommand = query;
DataSet
mydataset =
new
DataSet
();
con.Open();
mysqldataadapter.Fill(mydataset, "email");
DataTable
mydataTable = mydataset.Tables[
"email"
];
foreach (
DataRow
DR
in
mydataTable.Rows)
{
//Bitmap bmp1 = CreateBitmapImage(DR[1].ToString());
Bitmap
bmp1 =
new
Bitmap
(DR[1]);
bmp1.Save(
"c:\\image\\"
+ DR[0] +
".Jpeg"
, System.Drawing.Imaging.
ImageFormat
.Jpeg);
}
Reply
Answers (
1
)
FillMethod in ADO.NET
Web Control SDK and DDKs