473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Sending XML Image

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
Nov 12 '05 #1
2 3072
Nevermind...I stored the info in a dataset and set it on its merry way.
"Rob T" <RT*********@DONTwalchemSPAM.com> wrote in message
news:eR**************@TK2MSFTNGP10.phx.gbl...
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

Nov 12 '05 #2
Nevermind...I stored the info in a dataset and set it on its merry way.
"Rob T" <RT*********@DONTwalchemSPAM.com> wrote in message
news:eR**************@TK2MSFTNGP10.phx.gbl...
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

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: =?Utf-8?B?UHJ6ZW1v?= | last post by:
Hi, I would like to have a web service method sending a bitmap image. But code like do not work: <WebMethod()_ Public Function GetBitmap() As Drawing.Bitmap Dim a As New...
4
by: david | last post by:
hello, I have a client/server application. the server capture picture from webcam and send it to every client connected to it.the network part works good and the capture from webcam too. I...
2
by: Aneesh Pulukkul[MCSD.Net] | last post by:
Hi, I have a HTML page and associated images. I need to send the HTML as email -the email should also display the images at respective places. So am sending the content of HTML file as...
1
by: deric | last post by:
Hi! I'm new to VB.net programming on printing a page to a thermal printer (Epson T88IV). I really had a hard time figuring out how to code the printing of a bitmap image and some text, while sending...
0
by: RussCRM | last post by:
I want to use a command button, say "cmdDisplayImage" to display/ transfer a captured image from the ezVidCap1 control to an image or OLE box on the same form such as "PhotoPreview" (not sure...
0
by: Charles Crawford | last post by:
Hi, This apparently is a common problem and I've yet to read a solution that actually works for my specific situation. I have a Zebra RW220 printer that I connect to via Bluetooth connection...
0
by: =?Utf-8?B?Q2hhcmxpZQ==?= | last post by:
Hi, This apparently is a common problem and I've yet to read a solution that actually works for my specific situation. I have a Zebra RW220 printer that I connect to via Bluetooth connection...
3
by: FFMG | last post by:
Hi, I want to send expiry headers along with my images. This is the code in my .htaccess file Code: -------------------- ...
31
by: happyse27 | last post by:
Hi All, I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it...
2
by: ksheerasagar17 | last post by:
Hello All, Scenario: Sending an image through webservice as byte array to an Java webservice. The Problem1: The webservice method image property expects (data type) SByte rather than Byte...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.