473,396 Members | 1,895 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,396 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 1271

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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...

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.