There was a problem loading the comments.

Connect to MySQL database from ASP

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
Below is the sample script for the connection string.

Dim sConnection, objConn , objRS

sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=Your_Mysql_DB; UID=mysql_username;PASSWORD=mysql_password; OPTION=3"

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open(sConnection)

Set objRS = objConn.Execute("SELECT FirstName, LastName FROM tblUsers")

While Not objRS.EOF
Response.Write objRS.Fields("LastName") & ", " & objRS.Fields("FirstName") & "
"
Response.Write & " "
objRS.MoveNext
Wend

objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing


Share via

Related Articles

Copyright © 2021 TheGigabit. All right reserved. Reg.No: 200701034297 (792326-P)