Teacher Selection


<% 'Dimension variables Dim adoCon 'Holds the Database Connection Object Dim rsWebContent 'Holds the recordset for the records in the database Dim strSQL 'Holds the SQL query for the database 'Create an ADO connection object Set adoCon = Server.CreateObject("ADODB.Connection") 'Set an active connection to the Connection object using a DSN-less connection adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("ParentTeacherConf.mdb") 'Set an active connection to the Connection object using DSN connection 'adoCon.Open "DSN=cms" 'Create an ADO recordset object Set rsWebContent = Server.CreateObject("ADODB.Recordset") 'Initialise the strSQL variable with an SQL statement to query the database strSQL = "SELECT * FROM tblTeachers;" 'Open the recordset with the SQL query rsWebContent.Open strSQL, adoCon 'Loop through the recordset Do While not rsWebContent.EOF 'Write the HTML to display the current record in the recordset Response.Write ("") Response.Write ("
") Response.Write (rsWebContent("TeacherName")) Response.Write ("") Response.Write ("
") Response.Write ("
") 'Move to the next record in the recordset rsWebContent.MoveNext Loop 'Reset server objects rsWebContent.Close Set rsWebContent = Nothing Set adoCon = Nothing %>