.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Take image or Binary object From SQL and Pass into an XML Document

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net

I have a SQL Table which holds document data in the form of type image (or possibly binary but as far as I can see image is more reliable).

I have a websewrvice which needs to pull the documents from the database, pass the details into an XML file which is retrieved by the application calling the webservice, and then the document files written out at the other end.

My question is what is the best way to go about this?

I believe (but possibly I am wrong) that I need to convert the image data to base64 first.  I know there is the sql command select X from A FOR XML AUTO, BINARY BASE64 which does the conversion but I am not sure how to then write this into an XML document.

Any assistance any one can offer is greatly appreciated as I have not had any experience with working with binary or image, and only very very basic knowledge of XML

View Complete Post

More Related Resource Links

Pass ASP.NET membership identity object across domain?


I am trying to figure a way to SSO with ASP.NET membership and role model.

I can implement custom membership provider which consume web services hosting on a server.

With encryption of data. No problem.

But my question is, If I sign on a website with my provider, got my identity object on that application,

could I pass it to another website on another domain which use the same provider and by doing so, do not need to login again?

If this is possible, I am going to implement this solution. Please tell me what's your take on this.

Help ~~ How to Update Binary Image on Formview

Hi All ~~ I'm confused, Can i have some help please... Thanks
Database: Books
uid dataType uniqueidentifier
Cover dataType image 
aspx :
 <asp:FormView ID="FormView1" runat="server" BackColor="LightGoldenrodYellow"   BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataKeyNames="uid"     DataSourceID="SqlDataSource1" ForeColor="Black" Width="525px">
         <table class="table_width">
                 <td class="imageWidth">
                     <asp:Image ID="Image1" runat="server" Height="245px" 
                                       ImageUrl='<%# IIF(Eval("Cover") Is DbNull.Value, "~/Styles/Global/CFZ-No-Images.png", Eval("uid", "~/ImageServices.ashx?BooksID={0}")) %>' Width="180px" />

Problem with passing an Image as binary through web service



I have a web service that is accessed by a windows forms application and receives updates like facility name, address, image etc. Everything works fine except the image data is not being passed to the windows app. I am saving the images in database on both sides, so when I pull it from the server I use the following code

if (!reader.IsDBNull(floorPlanOrdinal))

facility.FloorPlan = (byte[])reader["FloorPlan"];

I can see the facility.FloorPlan Dimentions as 103840 when I debug this method which means that the data is pulled from the database fine.

On the forms side though the dimentions become 0, all other values pass fine except this. Here is the facility property in the web service on server side.

using System;

using System

Copy non-visible area of a panel to image object?

Hello, I'm using VS2008 and I would like to copy the entire area of a panel to an image object (bitmap image).  There are lots of examples out there describing how to copy certain areas of the screen, but I would like to capture the entire area of a panel, even if a portion of the panel is not currently visible. Or perhaps you can suggest a different way to achieve my goal - that is, I have a table layout panel with some various lineshapes drawn onto it, and I am aiming to recreate or simply include it on a rdlc report as an image.  Because of the various lineshapes that are included in the tablelayoutpanel, a datagrid/table/matrix control doesn't appear to be an option.  So I'm aiming to copy the tablelayoutpanel to a bitmap image object, then insert that into an image control on the report.  Any ideas? Thanks!

how do I pass in a standard xml+xsl to be converted through the Sharepoint 2010 Document Conversion

How do I pass in a standard xml+xsl to be converted through the Sharepoint 2010 Document Conversion? Via the SDK I have been able to code a c# workflow that converts word files in a Sharepoint 2010 Document Library (docx,dox, word.xml) to PDF successfully but want to pass in an xml+xsl file to this engine if possible. Actually I have xml, xsl, and if needed xsl-fo files to deal with but would be happy if I could figure out how to make the Document Conversion engine do the xml+xsl transform and then send that to a doc file in Sharepoint.    

How to Display Binary Image in RDLC in asp.net?

Hi, I want to display Binary image from Database in RDLC. Can some one help me out.   Thanks in advance..  

How to Pass a Grid an EF Object and have it edit/update etc. without postbacks until save?

Hey all.Here's what I'm trying to do:I want to pull an EF object, or create a new one. Pass it to javascript (jquery or some such) and then have the grid bind on the client side and do everything client side from that point forward. (edits, validation etc.) Once complete, I want jquery to push back via a pagemethod or web service or whatever, the updated EF object so that i can persist it.Reason?I need a highly scalable architecture that handles not storing objects in the session or posting to a database when they haven't been saved to a user. I know I can do this with Silverlight, however given MS's less than convincing comments about Silverlight's future vs HTML 5, I'm strongly leaning towards asp.net or mvc.net if I can come up with a way to use jquery (or even a 3rd party control that does this!) to handle all of the data editing, updating etc. for a master/child display (i.e. Invoice) without the server having to store it and without having to use the viewstate.Ideas?In my mind this would be the holly grail. Render the page, push the data to the controls, have the controls do their thing until save without ever doing server processing, and then on save, push back the object and allow the server to persist it (and probably do server validation before presisting it just in case). By doing this you could make superscalable apps that

Converting a System.Windows.Control.Image object to byte array.

Hi i need to convert a specific System.Windows.Control.Image object into an (int) array, because i'm trying to convert a silverlight application into a wpf project. private void createGi02GradBrush()<br/> {<br/> WriteableBitmap oWriteableBitmap = new WriteableBitmap(256, 256);<br/> Image oImage = new Image();<br/> oImage.Arrange(new Rect(0, 0, 256, 256));<br/> oImage.Measure(new Size(256, 256));<br/> oImage.Source = new WriteableBitmap(256, 256);<br/> Gi02GradShaderEffect oGi02GradShaderEffect = new Gi02GradShaderEffect();<br/> oGi02GradShaderEffect.pArray = oPImageBrush;<br/> oGi02GradShaderEffect.gi1GradArray = oGi1GradImageBrush;<br/> oImage.Effect = oGi02GradShaderEffect;<br/> oWriteableBitmap.Render(oImage, null);//here<br/> oWriteableBitmap.Invalidate(); <br/> this.oGi02GradImageBrush = new ImageBrush();<br/> this.oGi02GradImageBrush.ImageSource = oWriteableBitmap;<br/> } I've found some similar topics however Image object is not the same and most of its methods aren't available. Here I'm rendering a writablebitmap with a given Image object, but in wpf we need an array. oWriteableBitmap.Render(oImage, null); Any idea? Thanks. Joseph.  

Silverlight client object model : Read a document from a document library

How do I read/download a document/file from a SharePoint document library using silverlight client object model? The most closest function that I found was: Microsoft.SharePoint.Client.File.OpenBinaryDirect() but this seems to be throwing an exception "Operation not supported".

How Do You Insert An Image From The Image Folder Into A Binary Column?

Hello Forum, How would I go about inserting an image that's in my images folder into a sql table column of datatype varbinary(MAX) ?    Thank you

Aggregate Object Pass as a hidden value

How to use Html.Hidden for aggregate object?For Example, I have Model1 which aggregates Model2. Model:class Model1{.. public Model2 model2;..} class Model2{ public int id; public int name; .... //there are many fields//  } View:ViewPage is tied with Model1.ViewPage<Model1> I can pass Model2 values by specifiying its fields like<%= Html.HiddenFor(x => x.model2.id) %><%= Html.HiddenFor(x => x.model2.name) %> What I want is to pass Model2 as hidden value without specifying its each field. Any idea how to correct line below<%= Html.HiddenFor(x => x.model2) %>//I'm getting null value for model2 Thanks  

Extract document for a SPListItem from a Document Library using the Object Model


WSS 3.0

I want to use the object model to extract the document from a Document Library. I am doing a foreach(SPListItem item in docLib).

How can I use SPListItem to get the document for that item?

'document.getElementById(...)' is null or not an object


i am making use of the following javascript at page_load event, to fill the default value of textbox, txtBuinessUserMailID at run time:

 void Page_Load(object sender, EventArgs e)//Initialize a stringbuilder object, much faster than string concatenation


Writing image binary data to the Response


Hi there,

I've created 2 web user controls. A = User control that displays an image, and B is the user control that hosts A. I'm trying to stream an array of bytes to A, but it seems like the Response.BinaryWrite method completely overwrites any heirachial controls (I can't see any of B's other controls besides the image).

How do I get A to just display the image from the byte stream? It doesn't come from a database, it's an image I created on the fly.

A's code:

        public void UpdateImage(byte[] imgbytes)
            Response.ContentType = "image/jpg";


pass XML document to WCF service?



I am new to WCF. So some one please help me out. I need to pass XML document to my WCF service.

And send back, XML Ack message to client.

How do i need to do? any sample can you provide?

View previous version of a file in document library using Client Object Model




Using Server-side object model, it is pretty simple to get the previous file versions. Say I wanted to view a file in its initial version, all I’d need to do is :




When using Client object model, I couldn’t any analogous method/property which would let me fetch the previous version of file.

Can somebody point me to a sample or the property which would serve my purpose?

Binary Data Problem....save and retrive image data from sql database


hello friends...please help me to solve this problem....

i have created crud (create, retive, update and delete)form and it's running... here i want to add images for each record(sql database)....

i'm using image datatype in sql table for picture.....

Q 1: how to save and retrive binary data(image) from sql table in asp.net form using vb coding?

Q2: can i create sql table which store binary(image url) data direct?

thank you

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend