How do I connect to my MySQL Database with ASP?   (published: 6/18/2003 2:50:17 PM)
Article # 182
Title How do I connect to my MySQL Database with ASP?

You should always use mysql.hosting-advantage.com as the database server

Sample DSN Connection (ASP):
ConnString = "DSN=DSN_NAME;UID=DATABASE_USERNAME;

PWD=DATABASE_PASSWORD;DATABASE=DATABASE_NAME"

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConnString
Conn.Execute .....
....
....
Conn.Close
Set Conn = Nothing


Sample DSN-Less Connection (ASP):
set conn = createobject("ADODB Connection")

conn.open = "DRIVER={MySQL ODBC 3.51 Driver};"_
                        & "SERVER=mysql.hosting-advantage.com;"_
                        & " DATABASE=YourDatabaseName;"_
                        & "UID=YourUsername;PWD=YourPassword; OPTION=35"

  set rs = conn.Execute("SELECT * FROM testTable")
  'fetch the initial table ..
    rs.MoveFirst
    response.write (String(50, "-") & "Initial my_ado Result Set " & String(50, "-"))
    For Each fld In rs.Fields
      response.write fld.Name
      Next
      response.write "<br>"

      Do Until rs.EOF
      For Each fld In rs.Fields
      response.write fld.Value
      Next
      rs.MoveNext
      response.write "<br>"
    Loop
  rs.Close


 

More Information
Related information
Related download(s)
Did you find this useful?  [rate this article]
This article has been viewed 325 times
Average reader rating 0 out of 10

©2003 NetFronts Inc.