Dear All
Can anyone tell me how to save an JPEG image in a database table field?
Below is the code that I have wrote but it gives an error:
System.InvalidC astException
Object must implement IConvertible
DatabaseAccess. SqlConnection.O pen()
picDataAdapter. InsertCommand = New SqlCommand("INS ERT INTO TheImage(AppNo,
theImage) VALUES(@appno, @theImage)", DatabaseAccess. SqlConnection)
picDataAdapter. InsertCommand.P arameters.Add(" @appno", SqlDbType.Int). Value =
AppNo
picDataAdapter. InsertCommand.P arameters.Add(" @theImage", SqlDbType.Image ,
7000).Value = MyImage
picDataAdapter. InsertCommand.E xecuteNonQuery( )
DatabaseAccess. SqlConnection.C lose()
TheImage table has two fields:
AppNo int
theImage Image
myImage is of Image type
Waiting for reply... Thanks in advance
Regards
Ishtiaque Ahmed Memon 1 1029
Hi,
You need to convert the image to a byte array to save it in a
database. There is an example in this tip. http://www.vb-tips.com/dbpages.aspx?...6-38b5a2f7fdf0
Ken
-------------------
"Ishtiaque Ahmed Memon" <is*********@ya hoo.comwrote in message
news:Ob******** ******@TK2MSFTN GP06.phx.gbl...
Dear All
Can anyone tell me how to save an JPEG image in a database table field?
Below is the code that I have wrote but it gives an error:
System.InvalidC astException
Object must implement IConvertible
DatabaseAccess. SqlConnection.O pen()
picDataAdapter. InsertCommand = New SqlCommand("INS ERT INTO TheImage(AppNo,
theImage) VALUES(@appno, @theImage)", DatabaseAccess. SqlConnection)
picDataAdapter. InsertCommand.P arameters.Add(" @appno", SqlDbType.Int). Value
=
AppNo
picDataAdapter. InsertCommand.P arameters.Add(" @theImage", SqlDbType.Image ,
7000).Value = MyImage
picDataAdapter. InsertCommand.E xecuteNonQuery( )
DatabaseAccess. SqlConnection.C lose()
TheImage table has two fields:
AppNo int
theImage Image
myImage is of Image type
Waiting for reply... Thanks in advance
Regards
Ishtiaque Ahmed Memon
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andras Gilicz |
last post by:
Hi VB fans
I'm working on a relatively large project in VB6 with about a dozen
forms, including graphs, labels, text boxes, etc. The software itself
is actually a flow simulator with more or less complex technical
calculations, several input variables. I would like to equipp the
starting panel with the usual New, Open, Save, Save As, Close etc.
menus (like in Excel, or Word, etc.) What is the best way to
accomplish Save, or Save As?...
|
by: Carl |
last post by:
Please can anyone tell me how I can create a macro to save the results
of a query as an excel file? The query is called Student List and I
would like to save it to "My Documents".
We have had some problems with our database crashing. We would
therefore like another way to have access to basic student data and
thought we automatically save the results of this query when we close
Access.
Any suggestions on how we could do this would be...
|
by: joseph.inglis |
last post by:
I have a web browser object on a form which I have set to edit mode and use
the UCOMIConnectionPointContainer interface to hook in and catch events.
All working sweetly.
Except there are instances where i rewrite the Document.Content and the
|
by: Shanli RICHEZ |
last post by:
I'm using ASP.NET and quite a lot of object in memory instead of a database.
The question is that I tried to save the data, serialize them in a XML file
to save them when the application is ending.
event : Application_End in Global.asax.
But the object are not accesible from there so I can't save them.
Any idea ???
|
by: xAvailx |
last post by:
Hello:
I didn't find any documentation that notes save point names are case
sensitive, but I guess they are...
Stored Proc to reproduce:
/* START CODE SNIPPET */
If Exists (Select * From sysobjects Where Type = 'P' and Name =
| |
by: Josetta |
last post by:
Access 2003
I've been experiencing some problems with my "monster" database the
last couple of days. I imported all objects into a new database
yesterday, which pretty much stopped the crashing problems, but here's
something weird: Whenever I copy an object (reports so far), I am
able to open it and make changes, but when I try to save it (without
closing), it appears to save (message box goes off), but it doesn't.
Then, if I try to...
|
by: TonyJ |
last post by:
Hello!
I'm using VS2005.
I'm looking at ADO.NET and have found some test tutorial solution on
microsoft MSDN.
The one that I'm looking at now is called Walkthrough: Saving Data to a
Database (Single Table)
I have followed the walkthrought exectly but it doesn't work as expected.
|
by: chike_oji |
last post by:
Please can someone help me. I am writing a web application,
that allows for the upload of an excel sheet into the database.
I have an upload button and a save button.
The upload button allows for the retrieval of the excel data into
a DataTable, which is bound to a GridView for previewing before
saving to the Database.
But, whenever I click on the save button, I lose the DataTable's data,
so I lose the data I want to save to the...
|
by: evenlater |
last post by:
I have an Access application on a terminal server. Sometimes my users
need to export reports to pdf, rtf or xls files and save them to their
own client device hard drives.
They can do that right now the way I have this set up, but it's
confusing and slow. When they browse for a place to save the reports,
they see all of the drives on the terminal server as well as their own
client drives. So they're likely to want to choose "My...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |