I have a VB/SQL Server 7 app that I am working on.
I need to save image types to the database but I keep running into an "Invalid Input Parameter Value" error.
Here is the VB code and stored procedure:
Public Function FileToBlob(ByVal FName As String, _
lngCTXID As Long, _
Optional Threshold As Long = 1048576) As Boolean
Dim F As Long, Data() As Byte, FileSize As Long, fld As ADODB.Field
DataEnv.GetSubmissionSheet lngCTXID
If Not DataEnv.rsGetSubmissionSheet.EOF Then
With DataEnv.rsGetSubmissionSheet
Set fld = .Fields("SubSheet")
F = FreeFile
Open FName For Binary As #F
FileSize = LOF(F)
Select Case .Fields("SubSheet").Type
Case adLongVarBinary 'adLongVarBinary
If FileSize > Threshold Then
ReadToBinary F, fld, FileSize
Else
Data = InputB(FileSize, F)
fld.Value = Data
End If
End Select
Close #F
'.Close
DataEnv.UpdateSubSheet lngCTXID, fld
End With
End If
End Function
CREATE PROCEDURE dbo.spUpdateSubSheet
(
@CTXID int, @SubSheet image
)
As
Update CTXMaster
Set SubSheet = @SubSheet
Where CTXID = @CTXID
GO
Any ideas/suggestions?
Rene'
I need to save image types to the database but I keep running into an "Invalid Input Parameter Value" error.
Here is the VB code and stored procedure:
Public Function FileToBlob(ByVal FName As String, _
lngCTXID As Long, _
Optional Threshold As Long = 1048576) As Boolean
Dim F As Long, Data() As Byte, FileSize As Long, fld As ADODB.Field
DataEnv.GetSubmissionSheet lngCTXID
If Not DataEnv.rsGetSubmissionSheet.EOF Then
With DataEnv.rsGetSubmissionSheet
Set fld = .Fields("SubSheet")
F = FreeFile
Open FName For Binary As #F
FileSize = LOF(F)
Select Case .Fields("SubSheet").Type
Case adLongVarBinary 'adLongVarBinary
If FileSize > Threshold Then
ReadToBinary F, fld, FileSize
Else
Data = InputB(FileSize, F)
fld.Value = Data
End If
End Select
Close #F
'.Close
DataEnv.UpdateSubSheet lngCTXID, fld
End With
End If
End Function
CREATE PROCEDURE dbo.spUpdateSubSheet
(
@CTXID int, @SubSheet image
)
As
Update CTXMaster
Set SubSheet = @SubSheet
Where CTXID = @CTXID
GO
Any ideas/suggestions?
Rene'