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
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