473,320 Members | 2,111 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,320 software developers and data experts.

Transfer the Image Stored in a .gif File to an Image Column in a SQL Server Table

I am trying to use images in my web form and I am trying to write thie executable to help transfer the gifs into the SQL column. Here is my code, I am getting an error. All help is appreciated. Thanks in advance.
-----------------------------------------------------------------------------------------
Dim connString1 As String = ConfigurationSettings.AppSettings("connString1") 'bkf-sql1/jHelp
Dim cnnConnection As New System.Data.SqlClient.SqlConnection(connString1)
Dim rs As ADODB.Recordset
Dim mstream As ADODB.Stream
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_OnClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
connString1 = ConfigurationSettings.AppSettings("connString1") 'bkf-sql1/jHelp
cnnConnection.Open()

rs = New ADODB.Recordset
rs.Open("Select Mag_Image from MagDirect_List", cnnConnection, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)

mstream = New ADODB.Stream
mstream.Type = ADODB.StreamTypeEnum.adTypeBinary
mstream.Open()
mstream.LoadFromFile("<C:\Inetpub\wwwroot\Magazine Direct\Magbmps>")
rs.Fields("MD_Image").Value = mstream.Read
rs.Update()

rs.Close()
cnnConnection.Close()
__________________________________________________ ____________________________
Error:
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

Source Error:
Line 32:
Line 33: rs = New ADODB.Recordset
Line 34: rs.Open("Select Mag_Image from MagDirect_List", cnnConnection, ADODB.LockTypeEnum.adLockOptimistic, ADODB.CursorTypeEnum.adOpenKeyset)
Line 35:
Line 36: mstream = New ADODB.Stream
Jul 21 '05 #1
0 1264

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

Similar topics

0
by: vedwards | last post by:
I am trying to use images in my web form and I am trying to write thie executable to help transfer the gifs into the SQL column. Here is my code, I am getting an error. All help is appreciated....
9
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual...
1
by: Lyle Fairfield | last post by:
I created a new MS-SQL Database, "TestODBC". I made Table1 and StoredProcedure1. I made an ODBC DSN for that MS-SQL Database. I created a new AccessXP mdb, "TestODBC". I linked to the...
10
by: John Smith | last post by:
I know that uploading an image to a database has been covered, oh, about 3 trillion times. However, I haven't found anything covering uploading to a MySQL database with .net. Please don't...
35
by: Stan Sainte-Rose | last post by:
Hi, What is the better way to save image into a database ? Just save the path into a field or save the image itself ? I have 20 000 images (~ 10/12 Ko per image ) to save. Stan
8
by: yoyo | last post by:
Ok, I think I just may be a moron, but where the heck are the Image extenders found? I've look all around, tried all the DB2 cd's I have, are they installed by default somewhere? Which install...
2
by: satish | last post by:
hi, i have inserted the image present in mydocuments using alter command create table aa(a int, d image) insert into aa values (1,'F:\prudhvi\baba 002.jpg') when i do select * from aa i...
1
by: manmit.walia | last post by:
Hello All, I am stuck on a task that I need to complete. What I have is a SQL 2005 DB running with a Table called Docs. The table structure consists of the following: Table Structure for Docs...
3
by: itarunachalam | last post by:
Hi friends, I have a table structure like this in SQL sever 2000. i want a stored procedure to transfer the data from "tblSurvey" table to "tblRespondent" table. Table - tblSurvey...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.