Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-06-2009, 08:21 PM   PM User | #1
steaffy
New to the CF scene

 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
steaffy is an unknown quantity at this point
Question MySQL error (Microsoft VBScript runtime (0x800A01A8)

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
steaffy is offline   Reply With Quote
Old 10-06-2009, 08:50 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,247
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Ummm...you forgot to actually create a *RECORDSET*!!!

All you have there in Rs1 is a *STRING*!!
Code:
...
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.
Old Pedant is offline   Reply With Quote
Old 10-07-2009, 07:24 PM   PM User | #3
steaffy
New to the CF scene

 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
steaffy is an unknown quantity at this point
@ 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
steaffy is offline   Reply With Quote
Old 10-08-2009, 03:29 AM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,247
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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:
Code:
<%
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:
Code:
...
SQL = "SELECT * FROM resimler Limit "& iBaslangic &", "& SayfalamaKayitSayi
Set Rs1 = Conn.Execute( SQL )
if Rs1.eof then
    ...
exactly as I suggested.
Old Pedant is offline   Reply With Quote
Old 10-08-2009, 03:52 PM   PM User | #5
steaffy
New to the CF scene

 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
steaffy is an unknown quantity at this point
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
steaffy is offline   Reply With Quote
Old 10-08-2009, 06:59 PM   PM User | #6
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,247
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Time to learn my mantra: DEBUG DEBUG DEBUG

Start by doing:
Code:
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.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Tags
asp, mssql, mysql

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:59 AM.


Advertisement
Log in to turn off these ads.