Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Posts
    18

    Question Unanswered: using ASP to use a MySQL database

    Hi guys i've got a little problem when conencting to my mysql database. i am a new user to ASp and the IIs is a new concept to me. all my asp pages are stored in my C:\intepub directory. i have created an ODBC/dsn mysql connection to use with this coding. However when opening my test.asp it shows the 'couldn't connect to database' error. IS there anythign else i have to do when running asp pages? or is there something just wrong with the code below? i'm really stuck with this one and i'd be greatful for any help...

    thanks everyone

    test.asp:

    <%
    on error resume next
    dim adoConn
    dim adoRS
    dim counter
    set adoConn = Server.CreateObject("ADODB.Connection")
    set adoRS = Server.CreateObject("ADODB.Recordset")
    adoConn.Open "DSN=UgoUnited_dsn"
    adoRS.ActiveConnection = adoConn
    if adoConn.errors.count = 0 then
    response.write "<h2>Fields In The 'Members' Table:</h2>"
    adoRS.Open "describe members"
    while not adoRS.EOF
    response.write adoRS.fields(0).value & "<br>"
    adoRS.MoveNext
    wend
    else
    response.write "ERROR: Couldn't connect to database"
    end if
    %>

  2. #2
    Join Date
    Dec 2004
    Location
    York, PA
    Posts
    95
    ok I see what you are trying to do But sadly you have got the wrong method

    here is a link that will help you

    http://www.able-consulting.com/MDAC/...DriverForMySQL
    Sorry to be terse
    some say it's a curse
    I know it's worse
    I'm just diverse

  3. #3
    Join Date
    Jan 2005
    Posts
    18
    hey, thanks for that. It looks a lot easier that way, i'll give it a go.

    cheers!

  4. #4
    Join Date
    Jan 2005
    Posts
    18

    Using the script

    hi there, thanks for the link you gave me concerning my post:

    http://www.able-consulting.com/MDAC/...BC_DSNLess.htm

    Sadly i still haven't been able to make a connection using asp pages. where should i add that little bit of ODBC code? should it go into a sperate asp file...or should i replace these lines in my code:

    set adoConn = Server.CreateObject("ADODB.Connection")
    set adoRS = Server.CreateObject("ADODB.Recordset")
    adoConn.Open "DSN=UgoUnited_dsn"

    i'm really stuck and havn't made any progress. i'd be greatful for any advice. thanks for your time.

Posting Permissions

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