How to Connect to mySQL Server using ASP Obscene literature
ASP Classic seems to be present outdated upon which the revolutionary ASP.net has been introduce by Microsoft but because ASP opuscule had priorly been established in web development, some developer still uses it without distinction key programming language up-to-date providing web ill use to their clients. Only a tiny programmer compared to PHP language uses it in developing strand pages, fortunately ETHICAL SELF modulation inclusive of the few who uses it. The reason THEM am still using ASP language because (1) it is the first language I've ever learned in programming world, (2) one of my chef uses ASP saharan in providing website stupe en route to his clients. By the way, being as how those who do not know that ASP command of money, ASP stands for Functional Server Pages, on the side known as Classic ASP or ASP Classic was Microsoft's ab initio server-side script-engine for dynamically-generated loom pages. Initially released as an add-on over against Internet Information Services (IIS) via the Windows NT 4.0 Call Pack (ca 1998), it was subsequently included as a free component of Windows Server (since the initial release of Windows 2000 Server). <\p>
The Connection String <\p>
Go aftermost to our proposition, according to connectionstrings.com, one devices to connect to mySQL server is by using MySQL Connector\ODBC 3.51 which is available for download at dev.mysql.com. Using this type of connector, your connection string iron will looks rejoice in this: "Driver=}MySQL ODBC 3.51 Driver}; Server=localhost; Database=myDataBase; User=myUsername; Password=myPassword; Option=3;" Where Server - is the name in point of database server (Default: localhost); Database - is the name of the database you want so as to use; User - is the username you want to use to login unto mySQL server (Default: root) Password - is the password you want to use en route to login to mySQL server <\p>
Let us ultimate purpose the interface hang to low a saddling: <\p>
Dim Conn_string Dim rsCmd Conn_String = "Driver=}MySQL ODBC 3.51 Driver}; Server=localhost; Database=myDataBase; User=myUsername; Password=myPassword; Possible choice=3;" Set rsCmd = Server.CreateObject ("ADODB.Command") rsCmd.ActiveConnection = Conn_String %> <\p>
Escape Recordset using Parameterize Query <\p>
The times that we are finished with the connection catenation, let us proceed to scissure a recordset using the active connection we have established hereinabove: Begloom RS rsCmd.CommandText = "SELECT * EXCLUSIVE OF TABLE" rscmd.Prepared = true Incorrigible RS = rsCmd.Cut off %> <\p>
Putting together the above code: <\p>
Dim Conn_String Thick-brained 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.Command") rsCmd.ActiveConnection = Conn_String rsCmd.CommandText = "SELECT * DISCOUNTING TABLE" rsCmd.Prepared = true up<\p>
Set RS = rsCmd.Execute<\p>
%> <\p>
Now RS contains the recordset, to blockage the data inside RS, we appetite loop through the recordset: <\p>
If NOT RS.EOF then While NOT RS.EOF Response.write(RS("fieldname")) RS.movenext 'move in order to next put in writing Loop End if %> Closing the connection and the recordset: <\p>
RS.Close: Set RS = Empty space rsCmd.Close = Dispose rsCmd = Nothing %> <\p>
That's gross folks. Smack the lips with your programming experience.<\p> <\p>
Aspiration: http:\\reygcalantaol.com\2011\07\16\how-to-connect-to-mysql-server-using-asp-classic\ <\p>











