Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My SQL images

Status
Not open for further replies.

conceptmgt

IS-IT--Management
Sep 12, 2001
45
GB
Hi

The code below worked fine uploading images to MS SQL but does not work on MYSQL. I keep getting the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Invalid string or buffer length

/newslettersystem/clients/newsletteraddp.asp, line 32

Any ideas?

Thanks

Gary

MYSQL Database:

CREATE TABLE `images` (
`ImageID` INT(4) NOT NULL auto_increment,
`ImagePath` text DEFAULT NULL,
`ImageBlob` longblob,
`ImageSize` bigint(20) DEFAULT NULL,
`ContentType` text DEFAULT NULL,
PRIMARY KEY (`ImageID`)
)


ASP Code:

Dim Uploader, File
Set Uploader = New FileUploader
Uploader.Upload()

theclientID = Uploader.Form("clientID")
curpage = request.querystring("curpage")

i = 0
For Each File In Uploader.Files.Items
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")

Conn.open strconnect
RS.Open "Images", Conn, adOpenKeySet, adLockOptimistic, adCmdTable

RS.AddNew
RS("imagepath") = File.FileName
RS("imagesize") = File.FileSize
RS("contenttype") = File.ContentType
File.SaveToDatabase RS("imageblob")
RS.Update
ReDim Preserve arrImages(i)
arrImages(i) = RS("imageid")

RS.Close
conn.close

Set rs = Nothing
set conn = nothing
i = i + 1
Next


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top