Home > ASP Development > asp file upload script having problems with MYSQL

asp file upload script having problems with MYSQL



Hi There,

I am trying to connect to mysql db through asp with code that is to upload a file from a computer. I get this error:



Microsoft OLE DB Provider for ODBC Drivers error '80040e21'



Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.



/uploadexmple.asp, line 47





I am using code that i got from http://www.asp101.com/articles/jacob/scriptupload.asp, a program by jacob gilley to upload files with asp. Heres the bit thats giving me problems



ElseIf Uploader.Form("saveto") = "database" Then



' Open the table you are saving the file to

dim rs

Set RS = Server.CreateObject("ADODB.Recordset")

RS.open "select * from lecnotes", "Driver={Mysql}; Server=mysql1.webhost.ie; Database=paulmc; UID=paul; PWD=1881 ",2,2

RS.AddNew ' create a new record



RS("filename") = file.filename

RS("filesize")= File.FileSize

RS("contenttype") = File.ContentType



' Save the file to the database

File.SaveToDatabase RS("filedata")



' Commit the changes and close

RS.Update

RS.Close

End If



lecnotes is the name of the table where i'll store the file and it has properties:







Field Type Attributes Null Default Extra Action

filename varchar(20)

filesize varchar(20)

contenttype varchar(40)

filedata blob BINARY



any help appreciated...Thanks

    
Guest


I think we need opened connection to fetch data...

First Create Connection Object by Server.CreateObject("ADODB.Connection") then give it connection string...open it then use it..

You are same time creating recordset and connection that

's y creating problem for you...

Check for empty values /Column Types also..

Directly use table name when you intend to use "select * from"



Hope this helps..

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by master_key
I think we need opened connection to fetch data...

First Create Connection Object by Server.CreateObject("ADODB.Connection") then give it connection string...open it then use it..

You are same time creating recordset and connection that

's y creating problem for you...

Check for empty values /Column Types also..

Directly use table name when you intend to use "select * from"



Hope this helps..




Hey, thanks for the reply,

This doesn't seem to affect it though. I cahnged it around to open the connection first and then the recordset but I still get the same error!

Any other ideas??

thanks...

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved