Results 1 to 3 of 3

Thread: (ASP to Access) to (ASP to MYSQL) connection

  1. #1
    Join Date
    May 2003
    Location
    Winnipeg
    Posts
    2

    Question (ASP to Access) to (ASP to MYSQL) connection

    Hello I am new to MYSQL and I need to know how I can call so many records from my MYSQL data base…

    For Access I do this…
    ("SELECT Top 5 * From CategoryFile ORDER BY FileDate DESC")

    and when I connect my MYSQL up to it I get this error
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [MySQL][ODBC 3.51 Driver][mysqld-3.23.53-max-nt]You have an error in your SQL syntax near '5 * CategoryFile.


    Can some one help me out so I call only 5 records form the MYSQL data base?

    I am running this on a windows server.

    Thanks
    Rodney

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    TOP 5 is not ANSI standard so MySQL may not support it, you have to use WHERE clause to return five rows you want.

  3. #3
    Join Date
    May 2003
    Location
    Winnipeg
    Posts
    2

    Smile


    Thanks for your reply…
    I found out how I can do it...
    This is how I was able to do it…


    '************************************************* **********************************
    objRs.Open "SELECT * From File ORDER BY FileDate DESC", ConnNews, 0, 1
    objRs.PageSize = 5 ' Total files to display
    If objRs.BOF And objRs.EOF Then
    Response.Write ("Sorry no information to display at this time...")
    Else
    Do While Not objRs.EOF AND (Count < objRs.Pagesize)
    Response.Write ("" & vbNewline & _
    "<!-- Start "& objRs("FileName") &" File Table -->" & vbNewline & _
    "<hr width='95%' size='1' align='center' noshade>" & vbNewline & _
    ""&objRs("FileName")&"<BR>" & vbNewline & _
    ""&objRs("FileBody")&"<BR>" & vbNewline & _
    ""&objRs("FileDate")&"<BR>" & vbNewline & _
    "<hr width='95%' size='1' align='center' noshade>" & vbNewline & _
    "<!-- End "& objRs("FileName") &" File Table -->" & vbNewline & _
    "")
    objRs.MoveNext
    Count = Count + 1 ' Count
    Loop
    End If
    objRs.Close
    '************************************************* **********************************

Posting Permissions

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