SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 8th, 2003, 10:21 AM
admiral_chiu admiral_chiu is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 admiral_chiu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
need some help to connect ASP to mySQL... per "Using MyODBC" article suggestion...

Hello,

I am pretty new to ASP and I have a problem using it with mySQL.

I am using ODBC on my Win 2000 server for ASP application. I have set up
an ODBC driver (3.51) for mySQL and was able to create a local database. I
am facing a rather interesting problem:

I followed the instruction from a tutorial and set up a system DSN called
personalweb. After verifying the connection, I continued on and created a
sample ASP page to test it:

<%

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=personalweb"

adoRS.ActiveConnection = adoConn

if adoConn.errors.count = 0 then

response.write "<h2>Fields In The 'ruser' Table:</h2>"

adoRS.Open "describe ruser"

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

%>

Everything works, the columns were shown in the ASP page...

Now, the problem is when I continued on and follow the second instruction
in the tutorial and subsitute what I had with the following code:

<%

on error resume next

dim adoConn

dim adoRS

dim counter

set adoConn = Server.CreateObject("ADODB.Connection")

set adoRS = Server.CreateObject("ADODB.Recordset")

adoConn.Open "driver=
{mysql};database=personalinfo;server=localhost;uid
=adminbchiu;pwd=qwerty;"

adoRS.ActiveConnection = adoConn

if adoConn.errors.count = 0 then

response.write "<h2>Fields In The 'ruser' Table:</h2>"

adoRS.Open "describe ruser"

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

%>

The only thing I can get is the error message.

I am wondering what I have done wrong... Please help. Thanks

Reply With Quote
  #2  
Old April 9th, 2003, 02:45 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
What you've done is change the method used to connect you to the DB. Just use the DSN method and stick with it for now. Once you've got your head around ASP and DB connectivity, then you can mess around with other settings... for now, stick with what works.

Using DSN over another method won't restrict you in what you can and can't do with ASP.

Reply With Quote
  #3  
Old April 9th, 2003, 06:30 AM
admiral_chiu admiral_chiu is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 admiral_chiu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks for the reply. However, I am trying to learn other methods that I can connect to the database. Obviously I understand I can stick with what works. However, it's essential for me to learn other methods so that later on I have an option to do so.

BTW, I seem to have fixed the problem myself though, by changing the driver to mysql ODBC 3.51 driver and uid to username, pwd to password and other things... so it works now. Thank you.

Reply With Quote
  #4  
Old April 9th, 2003, 06:53 AM
EiSa EiSa is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Norway
Posts: 184 EiSa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 24 sec
Reputation Power: 6
Two good links about connection strings. They doesn't explain so much, but if you are wondering how a connection string should be written, you will probably find it here:

http://www.connectionstrings.com/

http://www.able-consulting.com/ADO_Conn.htm

Reply With Quote
  #5  
Old April 9th, 2003, 06:56 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
Ok - kewl - if you're learning, here's a few articles that tell you about DB connectivity... it's better to read articles about stuff that you're trying to learn, to figure out why and how they work, rather than just going off a tutorial.

http://www.4guysfromrolla.com/webte...ases/faq2.shtml
http://www.4guysfromrolla.com/webtech/042599-1.shtml

Reply With Quote
  #6  
Old April 9th, 2003, 08:27 AM
admiral_chiu admiral_chiu is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 admiral_chiu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thank you stumpy for the urls.

I did read articles. The original question came up when I read the article from devarticles.com called "Using MyODBC To Access Your MySQL Database Via ASP". That was recommended by one of the links on mysql.com when I downloaded the ODBC driver.

(URL)

That's how I found this forum, and that's why I was hoping some people would have read that as well and might provide help.

I was following the article's suggestion on setting up my ODBC driver and trying on different things.

My original question, was how come I was following the instruction on the article, and still can't get the desire result.

Now with all the other URLs, might be they will help me on this and other topics as well.

Again, thank you.

BTW, anybody out here tried the article in this domain? I would like to know some thought about it... Thank you.

Reply With Quote
  #7  
Old October 24th, 2005, 06:37 PM
kourosh kourosh is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 2 kourosh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 58 sec
Reputation Power: 0
same problem

Hello,

I have same problem and it is my code, thank you for your help


<html>

<!-- #include virtual="/databas/adovbs.inc" -->

<%
set Connect = Server.CreateObject("ADODB.Connection")

Connnect.Open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=kurf;USER=root;P ASSWORD=rishakawweman;OPTION=3;"

Set RecSet = Server.CreateObject("ADODB.Recordset")

if adoConn.errors.count = 0 then
response.write "<h2>Fields In The 'diwan' Table:</h2>"
else
response.write "ERROR: Couldn't connect to database"
end if

Addera = "SELECT * FROM diwan"

RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic

RecSet.AddNew

RecSet("Fornamn") = Request.Form("fornamn")
RecSet("Efternamn") = Request.Form("efternamn")
RecSet("Nicknamn") = Request.Form("nicknamn")
RecSet("Password") = Request.Form("password")

RecSet.Update
RecSet.Close
Connect.Close %>

Följande uppgifter har nu lagts till i databasen:<p>

Förnamn:<br><b><% =Request.Form("fornamn") %></b><p>
Efternamn:<br><b><% =Request.Form("efternamn") %></b><p>
Nicknamn:<br><b><% =Request.Form("nicknamn") %></b><p>
Password:<br><b><% =Request.Form("password") %></b><p>

Lägg till <a href="default.asp">fler poster i adressboken</a>.

</html>

Reply With Quote
  #8  
Old January 30th, 2006, 09:39 AM
r0cks0ul9o21 r0cks0ul9o21 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 1 r0cks0ul9o21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 41 sec
Reputation Power: 0
Wink hey same problem too

cfarne009@yahoo.com

please mail me a working code
and please disect it w/ explanations
main concern is the connection string
dns less
im having problem on w/c file should i call as a database

set adoConn = Server.CreateObject("ADODB.Connection")

set adoRS = Server.CreateObject("ADODB.Recordset")

adoConn.Open "driver=
{MySQL 3.51 Driver};database=sss; ---> this is the folder of my database
server=localhost;
uid =root;pwd=;"

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > need some help to connect ASP to mySQL... per "Using MyODBC" article suggestion...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway