PDA

View Full Version : MySQL error (Microsoft VBScript runtime (0x800A01A8)


steaffy
10-06-2009, 08:21 PM
Hi guys;
I created a site using the mssql codes but later for some reason I now have to recode the site using mysql codes.I am new to mysql world so please be gentle on me :).

I get this error "Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'SELECT * FROM resiml'
/tmken mysql/gallery.asp, line 66" when I try to access my page in the line 66. the code a little below and above line 66 is as this:

" <%
SayfalamaKayitSayi = 6

Rs1 = "SELECT * FROM resimler Limit "& iBaslangic &", "& SayfalamaKayitSayi
if Rs1.eof then
response.write "<br><b> NO Photos available !</b>"
else

iSayfa = Request.QueryString("p")
if Not Isnumeric(iSayfa) OR iSayfa = "" Then
iSayfa = 1
iBaslangic = 0
iBaslangic = (iSayfa-1)*SayfalamaKayitSayi
end if

rsmgs = "<b><a href=gallery.asp?page="&y&">["&y&"]</a></b> "
Do While Not Rs1.EOF

Response.Write "& rsmgs"

Rs1.MoveNext
Loop

%>"
and the line 66 is "if Rs1.eof then"
Please help me guys I am stuck here :(..
Thanks for the replies.
STEAFFY

Old Pedant
10-06-2009, 08:50 PM
Ummm...you forgot to actually create a *RECORDSET*!!!

All you have there in Rs1 is a *STRING*!!

...
SQL = "SELECT * FROM resimler Limit "& iBaslangic &", "& SayfalamaKayitSayi
Set Rs1 = yourAlreadyOpenConnection.Execute( SQL )
if Rs1.eof then
...

If you have not even created and opened the DB connection, then you still have to do *THAT* as well.

steaffy
10-07-2009, 07:24 PM
@ Old Pedant
Thank you for your reply bu I forgot to mention that i also include a file in my page which contains these codes:

<%
Dim Bag, Rs
Bag = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=database; UID=root;PASSWORD=q1w2e3!'3; OPTION=3"
Set Rs=Server.CreateObject("Adodb.Connection")
Rs.Open Bag
%>

please explain more your solutions as I am new to this mysql world.
Thanks

Old Pedant
10-08-2009, 03:29 AM
Well, your choice of name is bad.

Why would you use the name "Rs" (which, by convention, means "RecordSet") for an ADODB.Connection.

You *CAN* use that name, but it's confusing as all get out.

I would have done:

<%
Dim Bag, Rs
Bag = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=database; UID=root;PASSWORD=q1w2e3!'3; OPTION=3"
Set Conn = Server.CreateObject("Adodb.Connection")
Conn.Open Bag
%>

And then, in your other code, you would do:

...
SQL = "SELECT * FROM resimler Limit "& iBaslangic &", "& SayfalamaKayitSayi
Set Rs1 = Conn.Execute( SQL )
if Rs1.eof then
...

exactly as I suggested.

steaffy
10-08-2009, 03:52 PM
thank you for your reply..
I tried the exact code you suggested but got the following error which I couldn't figure out what it means...

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 3.51 Driver][mysqld-5.1.39-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 6' at line 1
/gallery.asp, line 66

Old Pedant
10-08-2009, 06:59 PM
Time to learn my mantra: DEBUG DEBUG DEBUG

Start by doing:

SQL = "SELECT * FROM resimler Limit "& iBaslangic &", "& SayfalamaKayitSayi
Response.Write "DEBUG SQL: " & SQL & "<HR>"

Set Rs1 = Conn.Execute( SQL )
if Rs1.eof then
...

If you can't see the DEBUG output, then *temporarily* put a Response.End directly after the Response.Write.