This is due to a known problem in ADO 1.5 (See Microsoft KB Article
182423). We recommend upgrading to MDAC 2 or later, which is available at http://msdn.microsoft.com/en-us/data/aa937730.
An alternate solution is to set the CursorLocation property to adUseClient (3). From the
SA-FileUp samples (.\Samples\UploadToDatabase\Simple\formrespdb.asp),
change the following lines if you are using SQL Server or Access:
'---
'--- Open a connection to the database. Note that the CursorType *must* be set
'--- to adOpenDynamic (2) when adding binary (BLOB) type data.
'---
set rsBlob = Server.CreateObject("adodb.recordset")
'---rsBlob.Open "SimpleBlobTable", "AccessUpload", 2, 3
'---
'--- SQL Server users should use the following lines to open the recordset:
'---
' If ADO 1.5 or higher use client cursors
set cBlob = Server.CreateObject("ADODB.Connection")
If CSng(Left(cBlob.Version,3)) >= 1.5 Then
rsBlob.CursorLocation = 3
End If
set cBlob = nothing
rsBlob.Open "SimpleBlobTable", "driver={SQL Server};server=<yourserver>;" + _
"uid=sa;pwd=<yourpw>;database=<yourdatabase>", 2, 3
'---
'--- Add new record and update
'---
rsBlob.AddNew
upl.SaveAsBlob rsBlob.Fields("filecol")
rsBlob.Update
rsBlob.Close
Set rsBlob = Nothing
|