How to convert image to base64, insert into XML file
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();