473,325 Members | 2,774 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,325 software developers and data experts.

change from access db to mysql

142 100+
Hi,

Can somebody please show me how to change the connection so I can make it work with my MYSQL database... I just need this login to work then I'm done wiht my project. I don't know what is going on here and is, this far from throughing my laptop into the wall.....

I want to change

cStr = "DRIVER={Microsoft Access Driver (*.mdb)};"
cStr = cStr & "DBQ=" & Server.MapPath("\path\to\database.mdb") & ";"
Conn.Open(cStr)

so it can work of from my MySQL database. my current dns

Connection.Open "DSN=mysql_dsn"

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Response.Expires = -1000 'Makes the browser not cache this page
  3. Response.Buffer = True 'Buffers the content so our Response.Redirect will work
  4.  
  5. Dim Error_Msg
  6.  
  7. login = Request.Form("login")
  8. If login = "logout" Then
  9.     Session("UserLoggedIn") = ""
  10.     ShowLogin
  11. Else
  12.     If Session("UserLoggedIn") = "true" Then
  13.         AlreadyLoggedIn
  14.     Else 
  15.         If login = "true" Then
  16.             CheckLogin
  17.         Else
  18.             ShowLogin
  19.         End If
  20.     End If
  21. End If
  22.  
  23. Sub ShowLogin
  24. Response.Write(Error_Msg & "<br>")
  25. %>
  26. <form name=form1 action=login.asp method=post>
  27. User Name : <input type=text name=username><br>
  28. Password : <input type=password name=userpwd><br>
  29. <input type=hidden name=login value=true>
  30. <input type=submit value="Login">
  31. </form>
  32. >%
  33. End Sub
  34.  
  35. Sub AlreadyLoggedIn
  36. %>
  37. You are already logged in.
  38. Do you want to logout or login as a different user?
  39. <form name=form2 action=login.asp method=post>
  40. <input type=submit name=button1 value="Yes">
  41. <input type=hidden name=login value="logout">
  42. </form>
  43. %>
  44. End Sub
  45.  
  46. Sub CheckLogin
  47. Dim Conn, cStr, sql, RS, username, userpwd
  48. username = Request.Form("username")
  49. userpwd = Request.Form("userpwd")
  50. Set Conn = Server.CreateObject("ADODB.Connection")
  51. cStr = "DRIVER={Microsoft Access Driver (*.mdb)};"
  52. cStr = cStr & "DBQ=" & Server.MapPath("\path\to\database.mdb") & ";"
  53. Conn.Open(cStr)
  54. sql = "select a from admin where a = '" & LCase(username) & "'"
  55. sql = sql & " and b = '" & LCase(userpwd) & "'"
  56. Set RS = Conn.Execute(sql)
  57. If RS.BOF And RS.EOF Then
  58.     Error_Msg = "Login Failed. Try Again."
  59.     ShowLogin
  60. Else
  61.     Session("UserLoggedIn") = "true"
  62.     Response.Redirect "pages.asp"
  63. End If
  64. End Sub
  65. %>
Sep 15 '08 #1
1 2103
jeffstl
432 Expert 256MB
mySQL conn strings

Try this. If you make changes and still cannot resolve your connection let me know.
Sep 16 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: John | last post by:
Hello. I am currently working through a book on Dreamweaver and using PHP. I am having a little trouble with setting up the database though. I have php 4.2.3 and MySQL 4.0.20a. I am running...
11
by: Mike MacSween | last post by:
My client has an MS Access database application on her local machine. I have full access to that in terms of changing the design. I've got a simple PHP/MySql application on shared hosting, so no...
0
by: SteveWa | last post by:
I have installed MySQL 4.0.15-0 from a RPM at the MySQL.com website using the command line syntax: root# cd /tmp/downloads root# rpm -i MySQL-server-4.0.15-0.i386.rpm after I install that...
17
by: chicha | last post by:
Hey people, I have to convert MS Access 2000 database into mysql database, the whole thing being part of this project I'm doing for one of my faculty classes. My professor somehow presumed I...
1
by: courtney.machi | last post by:
Hello, In order to access mysql I must type at the command prompt mysql --user='username' --password='password' How can I change it so that all I have to type is mysql
5
by: B1ackwater | last post by:
We've fooled around with Access a bit, but only using the single-user store-bought version. It seems to be a good database - versatile and infinitely programmable - and can apparently be used as a...
1
by: Jaime Leivers | last post by:
Here's a median function in access that you can call in any query. You could change this to any excel function you wanted. Most people can find the windows help file that says how to call an excel...
20
by: ajos | last post by:
Hi to all, Ok the situation that i have is im adding things in my database(something similar).The database that i was using was access and i had to change it to MySQL.As i came to know the date...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.