<%@ Language=VBScript %> <% Response.Buffer=True %> <HTML> <HEAD> <TITLE>Rick's Data Collection Session Table Access Page</TITLE> <script LANGUAGE="javascript"> Function frmRDCST3_onsubmit() { alert("Inside frmRDCST3_onsubmit!") //form validation routines //================================ var MustHaves var Wants var ZipFormat MustHaves = true; Wants = true; ZipFormat = true; // non-relevant code removed to save space if MustHaves=false || Wants=false || ZipFormat=false { window scroll(0,0); return false; } else { save(); return true; } } </script> <SCRIPT LANGUAGE="VBScript" > Function save() msgbox("Inside Save!") 'Rick's Data Collection Session Table record creation Page 'non-relevant code removed to save space END Function </script> </HEAD> <BODY> <H1 ALIGN="Center">Rick's Data Collection Response Page - Table Content</H1> <% Dim myString, mySQLstring Dim objRecordSet, objConnection, strConnection SET objRecordSet = Server.CreateObject("ADODB.RecordSet") SET objConnection = Server.CreateObject("ADODB.Connection") strConnection = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\inetpub\wwwroot\rick\nwind.mdb" objConnection.Open strConnection mySQLstring = "SELECT * FROM Customers ORDER BY CustomerID" SET objRecordSet = objConnection.Execute(mySQLstring, intRecordsAffected) IF intRecordsAffected < 0 THEN objRecordSet.MoveFirst %> <CENTER> Display upto the first 5 records matching the following SQL Statement<BR> <! SQL Statement: SELECT * FROM Customers ORDER BY CustomerID> SQL Statement: <%= mySQLstring %> <TABLE BORDER=1 COLS=<%=objRecordSet.Fields.Count %> > <TR> <% FOR EACH objField in objRecordSet.Fields %> <TH><%= objField.Name %></TH> <% NEXT %> </TR> <% intRecordsAffected = 0 DO WHILE NOT objRecordSet.EOF AND intRecordsAffected < 5 %> <TR> <% FOR EACH objField in objRecordSet.Fields %> <TD ALIGN=Right > <% IF ISNULL(objField) THEN Response.Write(" ") ELSE myString = objField.Value IF VARTYPE(mystring)=8 Then 'do nothing ELSE IF VARTYPE(mystring)=1 THEN myString = ".NULL." ELSE 'do nothing END IF END IF Response.Write(myString) 'Response.Write(objField.Value) END IF %> </TD> <% NEXT intRecordsAffected = intRecordsAffected + 1 objRecordSet.MoveNext %> </TR> <% LOOP %> </TABLE> <% Response.Write(intRecordsAffected & " records displayed!" ) %> </CENTER> <! Add new record> <! CustomerID - C(5) - Unique five-character code based on customer name.> <! CompanyName - C(40) > <! ContactName - C(30) > <! ContactTitle - C(30) > <! Address - C(60) - Street or post-office box. > <! City - C(15) > <! Region - C(15) - State or province. > <! PostalCode - C(10) > <! Country - C(15) > <! Phone - C(24) - Phone number includes country code or area code. > <! Fax - C(24) - Phone number includes country code or area code. > <% Dim txtCustomerID, txtCompanyName, txtContactName, txtContactTitle, txtAddress, txtCity, txtRegion, txtPostalCode, txtCountry, txtPhone, txtFax txtCustomerID = "AAAAA" txtCompanyName = "CompanyName" txtContactName = "ContactName" txtContactTitle = "ContactTitle" txtAddress = "Address" txtCity = "City" txtRegion = "Region/State" txtPostalCode = "PostalCode" txtCountry = "Country" txtPhone = "Phone" txtFax = "Fax" %> <HR> <FORM ACTION="rdc_f_cookie_session_table3.asp" NAME="frmRDCST3" METHOD="post" LANGUAGE="javascript" onsubmit="return frmRDCST3_onsubmit()"> <TABLE> <TH COLSPAN=3>Create New Customer record - all fields required!</TH> <TR> <TD><LABEL CLASS="InputLbl" ID="lblCustomerID">Customer ID:</LABEL></TD> <TD><INPUT ID="txtCustomerID" NAME="txtCustomerID" SIZE="6" MAXLENGTH="5" VALUE= <%=Request.Form("txtCustomerID") %>></TD> <TD>Unique five-character code based on customer name</TD> </TR> <! non-relevant code removed to save space > <TR> <TD></TD> <TD><INPUT ID="cmdSubmit" NAME="cmdSubmit" TYPE="SUBMIT" VALUE="Create New Customer Record"></TD> <TD></TD> </TR> </TABLE> </FORM> <% objRecordSet.Close SET objRecordSet = Nothing END IF %> </BODY> </HTML>