How do you add to a Database, an image

B

binaryBunny

I have a page in ASP.NET 1.1, that is connected to an Access Database.

Here is the functionality, textboxes that the user puts in the name,
surname, ID, Phone, etc.
a typical form-filling. But the problem arise when I actually want to
add an image. I'm not sure how to go about it.. Here is what I did
(assume that I've already connected to the DB) Using the Insert
statement that without using the wizard
..
..
..
Dim commandString AS String = "INSERT INTO Supplier(SupCode, SupName,
SupLogo) " & _
"Values(@SupCode, @SupName,
@SupLogo)"

Dim dbCommand As New OleDbCommand(commandString, dbConnection)

Dim SupCodeParam As New OleDbParameter("@SupCode",
OleDbType.VarChar, 6)
SupCodeParam.Value = txtsupCode.Text
dbCommand.Parameters.Add(SupCodeParam)

Dim SupNameParam As New OleDbParameter("@SupCode",
OleDbType.VarChar, 6)
SupCodeParam.Value = txtsupName.Text
dbCommand.Parameters.Add(SupNameParam )\

====================Problem arises with this
code=========================

Dim SupLogoPicParam AS New OleDbParameter("@SupLogo",
OleDbType.VarChar, 1)
'SupLogoPicParam.Value = img.Image
dbCommand.Parameters.Add(SupLogoPicParam )

==================================================================


Please, please anybody with the solution help.

I thank U in advance
 
G

Guest

Hi

You cannot use OleDbType.VarChar type to store a image, you need to use
OleDbType.Binary or OleDbType.VarBinary to do this. I hope you have OLE
Object as the data type for this column in the Access Database.

Hope this helps.

Prem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top