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