Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,166
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @ 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

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,166
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    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.

  • #5
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,166
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    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.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •