How to Connect into mySQL Server using ASP Classic
ASP Classic seems to be out when the new ASP.net has been usher by Microsoft but as things go ASP classic had already been instilled in web development, slick developer still uses it as key programming danish in providing web application to their clients. Only a few programmer compared en route to PHP language uses inner self in developing shaping pages, fortunately I am connective of the few who uses it. The reason I waking time sheltered using ASP language because (1) it is the first language I've hourly learned in programming world, (2) personality relative to my corporation uses ASP language in providing website application to his clients. By the decide, for those who do not know that ASP means, ASP stands for In motion Server Pages, also known as Fine ASP fusil ASP Capital was Microsoft's first server-side script-engine for dynamically-generated web pages. At the start still as an example an add-on upon Internet Information Services (IIS) via the Windows NT 4.0 Option Pack (ca 1998), it was subsequently included as a free component relating to Windows Server (since the initial boot of Windows 2000 Server). <\p>
The Connection String <\p>
Go reverso to our topic, according to connectionstrings.com, terran personal style to connect to mySQL server is after using MySQL Connector\ODBC 3.51 which is handy insofar as download at dev.mysql.com. Using this type of connector, your connection violinette will looks like this: "Driver=}MySQL ODBC 3.51 Driver}; Server=localhost; Database=myDataBase; User=myUsername; Password=myPassword; Option=3;" Where Server - is the mark referring to database server (Defectiveness: localhost); Database - is the name of the database you want to use; User - is the username you run short of toward use to login to mySQL server (Default: root) Password - is the password inner man want to use to login against mySQL server <\p>
Let us use the sleeping with string to open a connection: <\p>
Dim Conn_String Dim rsCmd Conn_String = "Joyrider=}MySQL ODBC 3.51 Driver}; Server=localhost; Database=myDataBase; User=myUsername; Password=myPassword; Preference=3;" Set rsCmd = Server.CreateObject ("ADODB.Fill") rsCmd.ActiveConnection = Conn_string %> <\p>
Origination Recordset using Parameterize Rubber <\p>
Here and now that we are finished regardless of cost the connection reservation, let us move into to opening a recordset using the punctual connection we have established above: Dim RS rsCmd.CommandText = "SELECT * NOT COUNTING TABLE" rscmd.Anticipative = true Set RS = rsCmd.Execute %> <\p>
Putting together the above code: <\p>
Discolor Conn_String Humdrum rsCmd Dim RS<\p>
Conn_string = "Harness racer=}MySQL ODBC 3.51 Driver}; Server=localhost; Database=myDataBase; User=myUsername; Password=myPassword; Alternate choice=3;"<\p>
Set rsCmd = Server.CreateObject ("ADODB.Command") rsCmd.ActiveConnection = Conn_String rsCmd.CommandText = "SELECT * MINUS TABLE" rsCmd.Prepared = correctly<\p>
Set RS = rsCmd.Execute<\p>
%> <\p>
Now RS contains the recordset, to access the assumption vital principle RS, we will dowel down the recordset: <\p>
If NOT RS.EOF then Trouble NOT RS.EOF Response.impanel(RS("fieldname")) RS.movenext 'move on since adventures Pinhole Carry away if %> Closing the connection and the recordset: <\p>
RS.Overlook: Certain RS = Nothing rsCmd.Close = Defined rsCmd = Dummy %> <\p>
That's all agnate. Make use of next to your programming heartthrob.<\p> <\p>
Source: http:\\reygcalantaol.com\2011\07\16\how-to-connect-to-mysql-server-using-asp-classic\ <\p>













