473,394 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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=way ne;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!!!!!!!!!!!!!!!!!!!!!!!!!!

Jul 19 '05 #1
1 2488
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=YO UR_USERNAME;pwd=YOUR_PASSW
ORD"

"Wayne..." <wa***@secretwebdesign.com> wrote in message
news:40******@212.67.96.135...
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=way ne;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!!!!!!!!!!!!!!!!!!!!!!!!!!

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sims | last post by:
Hi, I am trying to tidy up my code and now i am looking at my database work. Now correct me if i am wrong, (I am using mysql_connect). Lets assume a few functions... ...
3
by: Ken | last post by:
Yesterday I was able to connect and work with the database. Today, I cannot connect. I do not remember changing anything. I repaired Apache2. Do no know if it needed a repair. Reinstalled...
14
by: jj | last post by:
Is it possible to call a remote php script from within Access? I'm thinking something like: DoCMD... http://www.domain.com/scripts/dataquery.php DoCmd.OpenQuery "update_data", acNormal, acEdit...
3
by: KaHuNa | last post by:
I want make a connection with MySQL (don't know why, i need, that's all ; ) ) in C# but i don't know a lots the OleDbConnection, i have do that: using System; using System.Data.OleDb; class...
2
by: bylum | last post by:
help find error that connection database and jsp.. <% String connectionURL = "jdbc:mysql://localhost:3306/webaudio?user=root"; Connection connection = null; Statement statement = null;...
1
by: bylum | last post by:
help find error that connection database and jsp.. <% String connectionURL = "jdbc:mysql://localhost:3306/webaudio?user=root"; Connection connection = null; Statement statement = null;...
0
by: rhepsi | last post by:
Dear All, Im vb.net 1.1, When im trying to update the records from mysql to postgresql, the connection error: the following code is Update data button click: Dim myPgrConnect As...
2
by: Hetal | last post by:
Hi... I am a newbie VB.NET developer and i am looking at working with ADO.NET rather than ADO. In one of our native VB application with ADO, we used to create 1 connection object and that would...
5
by: john | last post by:
All: I have a MS background and am having fun in the open source world of PHP and MySQL --- and I have a question. With PHP and MySQL, is it considered better practice to open a single...
4
by: jmohan | last post by:
Hi everybody, How to write the connection string and sql queries in the XML. I use the mysql database. I use the following connection string and query using asp.net with C#. Connection...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.