Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Sending XML Image

Reply
Thread Tools

Sending XML Image

 
 
Rob T
Guest
Posts: n/a
 
      06-24-2004
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


 
Reply With Quote
 
 
 
 
Rob T
Guest
Posts: n/a
 
      06-24-2004
Nevermind...I stored the info in a dataset and set it on its merry way.


"Rob T" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem sending mail: Sending the email to the following server failed Luke Java 2 03-15-2007 10:54 AM
pls help me when i sent mail, it vil sending twice instead of once ,am using java.mail,am sending my code.... shailajabtech@gmail.com Java 0 09-28-2006 06:38 AM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
sending inline image in email via .net smtp mail Ersin Gençtürk ASP .Net 3 02-28-2005 10:00 PM
wx.Image: Couldn't add an image to the image list. Laszlo Zsolt Nagy Python 1 01-26-2005 09:55 PM



Advertisments