Sending XML Image

R

Rob T

Hi, I'm trying to send an image over XML. My routine gets the name, then
gets the image out of a SQL database. This part works fine... but the XML
returns the object, I get the following error: "System.Drawing.Bitmap
cannot be serialized because it does not have a default public constructor."

Here is a sample of the code:
<WebMethod(Description:="Send Image")> Public Function SendImage(ByVal
ImageName As String) As Object
Dim strSQL As String 'text SQL statement
Dim cmdSQL As SqlCommand 'SQL command

cnnCUS = New SqlConnection(strCUS)

strSQL = "select Img, ImgType from FormImg where ImgName='" & ImageName
& "'"
cmdSQL = New SqlCommand(strSQL, cnnCUS)
cnnCUS.Open()
SendImage = System.Drawing.Bitmap.FromStream(New
System.IO.MemoryStream(CType(cmdSQL.ExecuteScalar, Byte())))
cnnCUS.Close()

End Function


The code that calls the XML is something like this:

Dim Im as bitmap
Dim service As New XMLPrinter.xml_login()
Im = service.SendImage("myImage")

Thanks. -Rob T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top