View Full Version : ASP + MySQL + Update errors.

12-29-2004, 02:44 AM

I've changed one of my sites from an Access database to MySQL. Seem to have everything fixed on the site apart from one thing.
I have one page which uploads images into a database that is giving me some problems.

Here is what i am doing to save the image:

File.SaveToDatabase rs("photo_filedata")

SaveToDatabase looks like this:

Public Sub SaveToDatabase(ByRef oField)
If LenB(FileData) = 0 Then Exit Sub

If IsObject(oField) Then
oField.AppendChunk FileData
End If
End Sub

And the error i get on the rs.Update line:

Query-based update failed because the row to update could not be found.

I didn't write the class for uploading the file, I got it from a script I found on aspin.com (a few years ago) and just used it in my own site. Works nicely with Access. :)

I've done a good bit of googling and there seems to be a problem with MySQL and the ADO Update method. I would be a lovely solution if I could use SQL Update to add the file data to the database, but there is no nice function in ASP like PHP's stripslashs().
Has anyone got any idea how to get the file into the database with SQL or ADO?

Many Thanks,