Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1

Displaying Data to the Web Page


Now you'll create a Web page that displays all your customers. This page could be called from a hyperlink in
another page, or a person could go to it directly. As in the previous example, the code is shown in its
entirety, and then broken down a segment at a time. The code in Listing 13.4 was used earlier in the chapter.
We’ll go over it again, now that you have a better understanding of ADO.
Listing 13.4 Displaying Customer Data on the Web Page


10 <%@ Language=VBScript %>


20


30


40


50


60 <%


70 ' Variable Declaration


80 Dim rstCustomers 'ADO Recordset


90 Dim mConn 'ADO Connection


100 Dim mCmd 'ADO Command


110 Dim vRecordCount 'Counter


120 Dim vbgcolor ‘Back Ground Color


130 'Creating the ADO Objects


140 Set mConn = Server.CreateObject("ADODB.Connection")


150 Set mCmd = Server.CreateObject("ADODB.Command")


160 Set rstCustomers = Server.CreateObject("ADODB.Recordset")


170 'Setting the connection parameteres


180 mConn.CommandTimeout = 40


190 mConn.CursorLocation = 1 'Client Side


200 mConn.ConnectionString = "server=10.1.1.50;driver=MySQL;" &_


"db=Meet_A_Geek;uid=root;pwd=tacobell"


220 mConn.Open

Free download pdf