|
"My ASP script works on my server but it does not work on
your server."
MySQL Connection
Sometimes, you may be wondering how to make your ASP
script connect to the MySQL database that you have just got from us. You might
have received information like this from us:
===========================================================
MySQL ACCOUNT LOGIN INFO
===========================================================
Host : 202.157.142.106
Database name : mydatabase_db
Username : mydbuser
Password : mydbpass
===========================================================
There are many ways to connect to the database. Here is
just one example. The below is a simple example of how you can connect
to your database, using the information we gave you above, do a simple
query, and display the results.
<HTML>
<BODY>
<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "Driver={MySQL ODBC 3.51 Driver};" & _
"Server=202.157.142.106;" & _
"Database=mydatabase_db;" & _
"UID=mydbuser;" & _
"PWD=mydbpass;" & _
"Option=3"
SQL_query = "SELECT uid, fname, lname FROM mytable"
Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF
%>
<LI><%=RS("uid")%>: <%=RS("fname")%>: <%=RS("lname")%>
<%
RS.MoveNext
WEND
%>
</BODY>
</HTML>
|