Connection string for a MySQL database needed-this is driving me nuts!

W

Wayne...

I'm trying to get asp to conect to a MySQL database, I've tried copying a
few examples online that I found [there doesn't seem to be many!!] and I
always get a 500 error with the code below. what am i doing wrong?
any examples of a working connection string anyone could show me would be
fantastic. thanks i advance.

Wayne...

<%@ LANGUAGE="VBSCRIPT" %>
<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open = "DSN=main;Uid=wayne;Pwd=******;"

SQL_query = "SELECT * FROM content;"
Set RS = MyConn.Execute(SQL_query)
%>
<HTML>
<HEAD>
<TITLE>test</TITLE>
</HEAD>
<BASEFONT FACE="arial">
<BODY>

<p><b><% Response.Write SQL_query %></b></p>

<%while not RS.eof%>
<%=RS("")%>&nbsp;<%=RS("title")%>&nbsp;<%=RS("date")%>&nbsp;<%=RS("content")
%><br>
<%RS.MoveNext%>
<%wend%>

<%
RS.Close
MyConn.Close
%>
===========
the other version I tried:
===========
<%@ LANGUAGE="VBSCRIPT" %>
<%
strConnection =
"driver={MySQL};server=IP_NUMBER_GOES_HERE;uid=wayne;pwd=******;database=mai
n;option=NUM"
Set adoDataConn = Server.CreateObject("ADODB.Connection")
adoDataConn.Open strConnection

strQuery = "SELECT * FROM content;"
Set RS = adoDataConn.Execute(strQuery)
%>

==================
HEEELLLPPPP!!!!!!!!!!!!!!!!!!!!!!!!!!
 
2

[ + 2 0 r p 3 ]

you need to make sure you have the latest mysql odbc drivers installed.
available from www.mysql.org then this string should be good.

"driver={MySQL ODBC 3.51
Driver};server=YOUR_SERVER;database=YOUR_DB;uid=YOUR_USERNAME;pwd=YOUR_PASSW
ORD"

Wayne... said:
I'm trying to get asp to conect to a MySQL database, I've tried copying a
few examples online that I found [there doesn't seem to be many!!] and I
always get a 500 error with the code below. what am i doing wrong?
any examples of a working connection string anyone could show me would be
fantastic. thanks i advance.

Wayne...

<%@ LANGUAGE="VBSCRIPT" %>
<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open = "DSN=main;Uid=wayne;Pwd=******;"

SQL_query = "SELECT * FROM content;"
Set RS = MyConn.Execute(SQL_query)
%>
<HTML>
<HEAD>
<TITLE>test</TITLE>
</HEAD>
<BASEFONT FACE="arial">
<BODY>

<p><b><% Response.Write SQL_query %></b></p>

<%while not RS.eof%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top