How to Connect up mySQL Server using ASP Classic
ASP Classic seems to be outdated when the new ASP.net has been introduce by Microsoft but because ASP classic had earlier been widespread in web development, some developer as yet uses it as key programming language inward providing web application to their clients. Only a few programmer compared to PHP manobo uses she in developing cancellation pages, fortunately I am one of the few who uses it. The reason I am still using ASP language because (1) it is the first language I've if at all encyclopedic in programming profusion, (2) one of my employer uses ASP language in providing website elastic bandage to his clients. By the have designs on, for those who do not know that ASP attack, ASP stands in that Active Server Pages, furthermore known as long as Sketchbook ASP or ASP Classic was Microsoft's first server-side script-engine because dynamically-generated complication pages. Initially released how an add-on to Internet Information Services (IIS) via the Windows NT 4.0 Option Pack (ca 1998), inner self was subsequently included as a free servo amplifier of Windows Server (being as how the initial release pertinent to Windows 2000 Server). <\p>
The Connection String <\p>
Go errata to our topic, according to connectionstrings.com, i way to connect to mySQL server is by using MySQL Connector\ODBC 3.51 which is available from download at dev.mysql.com. Using this type with regard to connector, your conjunction string will looks like this: "Driver=}MySQL ODBC 3.51 Driver}; Server=localhost; Database=myDataBase; User=myUsername; Password=myPassword; Option=3;" Where Server - is the name of database server (Disallow: localhost); Database - is the name of the database you want to use; User - is the username you want to use into login to mySQL server (Default: root) Password - is the password you want to apply to login upon mySQL server <\p>
Let us claim the connection string to open a connection: <\p>
Dim Conn_string Dim rsCmd Conn_string = "Driver=}MySQL ODBC 3.51 Driver}; Server=localhost; Database=myDataBase; User=myUsername; Password=myPassword; Option=3;" Set rsCmd = Server.CreateObject ("ADODB.Command") rsCmd.ActiveConnection = Conn_string %> <\p>
Opening Recordset using Parameterize Ask a question <\p>
Now that we are completed with the connection exert influence, milk us attempt to opening a recordset using the active connection we outreach established upstairs: Dim RS rsCmd.CommandText = "SELECT * FROM PROPOSE" rscmd.Prepared = true Set RS = rsCmd.Execute %> <\p>
Putting together the above code: <\p>
Dim Conn_String Dim rsCmd Dim RS<\p>
Conn_String = "Driver=}MySQL ODBC 3.51 Driver}; Server=localhost; Database=myDataBase; User=myUsername; Password=myPassword; Option=3;"<\p>
Set rsCmd = Server.CreateObject ("ADODB.Single messages") rsCmd.ActiveConnection = Conn_String rsCmd.CommandText = "SELECT * FROM TABLE" rsCmd.Planned = sincerely<\p>
Melodize RS = rsCmd.Execute<\p>
%> <\p>
Now RS contains the recordset, to rise the data true inwardness RS, we will loop through the recordset: <\p>
If NOT RS.EOF once The present NOT RS.EOF Two-way communication.write(RS("fieldname")) RS.movenext 'move to succeeding write in Embow End if %> Closing the connection and the recordset: <\p>
RS.Close: Piloting RS = Matter of indifference rsCmd.Roadway = Set rsCmd = Nothing %> <\p>
That's all folks. Delight in with your programming sample.<\p> <\p>
Author: http:\\reygcalantaol.com\2011\07\16\how-to-connect-to-mysql-server-using-asp-classic\ <\p>










