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
How to convert image to base64, insert into XML file
Oct 26 2011 11:24 AM
Is there an easy way to query an image from sql database and place it into xml document in base64binary format?
I have the following code but I simply need to add an image to it (inmpicture) and convert it to that format.
SqlConnection
con =
new
SqlConnection
(
"server=###;database=###;Initial Catalog=###;uid=###;pwd=###"
);
query.Connection = con;
SqlCommand
query =
new
SqlCommand
(
"SELECT
inmpicture as Portrait
, ltrim(rtrim(a.bookno)) as BookingRecordIdentifier,ltrim(rtrim(a.ecsoid)) as PersonIdentifier, ltrim(rtrim(a.dob)) as Dob FROM jail.dbo.jailbook a where a.lname is not null"
);
mysqldataadapter.SelectCommand = query;
con.Open();
mysqldataadapter.Fill(mydataset, "AddBookingRecord");
mydataset.WriteXml("c:\\Mugshot.xml");
SqlDataAdapter
mysqldataadapter =
new
SqlDataAdapter
();
DataSet
mydataset =
new
DataSet
();
"AddBookingRecord"
);
DataTable
mydataTable = mydataset.Tables[
"AddBookingRecord"
];
"c:\\Mugshot.xml"
);
con.Close();
Reply
Answers (
6
)
Detect IP Conflict
Copy hyperlink content or highlight content from any web page