473,520 Members | 2,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 18 '05 #1
1 974
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 18 '05 #2

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

Similar topics

2
2346
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 Drawing.Bitmap("1.bmp", False) Return a End Function
4
12046
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 associate an event when a capture is done, then every frame of the webcam should be sent to the client. but I cannot find a way to send bitmap throught...
2
4668
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 MailMessage.Body and adding all the referred images using MailMessage.Attachments.Add(). The images referred using <IMG SRC="Logo.png" /are displaying...
1
6529
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 commands (through font control) to the printer. I tried sending the escape characters with Control font, but the Graphics.DrawString of...
0
1378
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 which one is possible/best...perhaps someone can help me...I'm new at this.) I really don't want to "save" it first. Then, I want another command...
0
2862
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 mapped to a serial port. The application I'm writing runs on a Windows Mobile 5 device, so there's no built in printer support and I have to use a...
0
3745
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 mapped to a serial port. The application I'm writing runs on a Windows Mobile 5 device, so there's no built in printer support and I have to use a...
3
2198
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
12608
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 is working for normal email servers, but NOT with gmail server, I am very puzzled still!!) Codes(item c below) It keeps complaining and logs and...
2
9769
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 array. Thus i'm converting a byte array to sbyte array and sending through web service. The converted SByte contains negative numbers wihch are resulting...
0
7204
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7439
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7602
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7164
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5742
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3282
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1646
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
506
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.