<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <HTML> <HEAD> <TITLE>OAC - Display An Access Table - Products -</TITLE> </HEAD> <BODY> <TABLE WIDTH="100%" BORDER="1" CELLPADDING="0" CELLSPACING="0"> <TH COLSPAN="10">Listing all records and field properties,<BR> for table: Products,<BR> from database: C:\Program Files\Microsoft Office\OFFICE\SAMPLES\Northwind.mdb.</TH> <TR><TD COLSPAN="10"><B>Relationship Information</B></TD></TR> <TR><TD ALIGN="CENTER">Table.Field</TD><TD ALIGN="CENTER">IsPrimaryKey?</TD> <TD>Count Of Tables /or/ Specify One Side Of Relationship</TD><TD COLSPAN="7"> </TD></TR> <TR> <TD ALIGN="LEFT">Products.CategoryID</TD><TD ALIGN="LEFT">False</TD> <TD ALIGN="LEFT">Categories.CategoryID</TD><TD COLSPAN="7"> </TD></TR> <TR> <TD ALIGN="LEFT">Products.ProductID</TD><TD ALIGN="LEFT">True</TD> <TD ALIGN="LEFT">1.</TD><TD COLSPAN="7"> </TD></TR> <TR> <TD ALIGN="LEFT">Products.SupplierID</TD><TD ALIGN="LEFT">False</TD> <TD ALIGN="LEFT">Suppliers.SupplierID</TD><TD COLSPAN="7"> </TD></TR> <TR><TD COLSPAN="10"><B>Create Dynamic HTML Table Code, from an Access Table.</B> (IsConnected means this field is a ForeignKey Field)</TD></TR> <TR> <TD ALIGN="CENTER"><B>ProductID</B></TD> <TD ALIGN="CENTER"><B>ProductName</B></TD> <TD ALIGN="CENTER"><B>SupplierID</B></TD> <TD ALIGN="CENTER"><B>CategoryID</B></TD> <TD ALIGN="CENTER"><B>QuantityPerUnit</B></TD> <TD ALIGN="CENTER"><B>UnitPrice</B></TD> <TD ALIGN="CENTER"><B>UnitsInStock</B></TD> <TD ALIGN="CENTER"><B>UnitsOnOrder</B></TD> <TD ALIGN="CENTER"><B>ReorderLevel</B></TD> <TD ALIGN="CENTER"><B>Discontinued</B></TD> </TR> <TR> <TD ALIGN="CENTER">adInteger - Auto</TD> <TD ALIGN="CENTER">adWChar</TD> <TD ALIGN="CENTER">adInteger</TD> <TD ALIGN="CENTER">adInteger</TD> <TD ALIGN="CENTER">adWChar</TD> <TD ALIGN="CENTER">adCurrency</TD> <TD ALIGN="CENTER">adSmallInt</TD> <TD ALIGN="CENTER">adSmallInt</TD> <TD ALIGN="CENTER">adSmallInt</TD> <TD ALIGN="CENTER">adBoolean</TD> </TR> <TR> <TD ALIGN="CENTER"> </TD> <TD ALIGN="CENTER"> </TD> <TD ALIGN="CENTER">Suppliers.SupplierID</TD> <TD ALIGN="CENTER">Categories.CategoryID</TD> <TD ALIGN="CENTER"> </TD> <TD ALIGN="CENTER"> </TD> <TD ALIGN="CENTER"> </TD> <TD ALIGN="CENTER"> </TD> <TD ALIGN="CENTER"> </TD> <TD ALIGN="CENTER"> </TD> </TR> <% If IsObject(Session("DB_conn")) Then Set Conn = Session("DB_conn") Else Set Conn = Server.CreateObject("ADODB.Connection") strSource = "C:\Program Files\Microsoft Office\OFFICE\SAMPLES\Northwind.mdb" strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""" & strSource & """" Conn.Open strConn ' Conn.Open "DSN=YourDataSourceName" ' for quick conversion to a DSN Set Session("DB_conn") = Conn End If Set rst0 = Server.CreateObject("ADODB.Recordset") StrSQL = "SELECT * FROM Products;" rst0.Open StrSQL, Conn, 3, 1 '3=adUseClient, 1=adOpenForwardOnly Set rst1 = Server.CreateObject("ADODB.Recordset") StrSQL = "SELECT * FROM Categories;" rst1.Open StrSQL, Conn, 3, 1 Set rst2 = Server.CreateObject("ADODB.Recordset") StrSQL = "SELECT * FROM Suppliers;" rst2.Open StrSQL, Conn, 3, 1 Do While Not rst0.EOF %> <TR> <TD><%= rst0("ProductID") %></TD> <TD><%= rst0("ProductName") %></TD> <TD><%= rst0("SupplierID") %><% rst2.Filter = "SupplierID = " & rst0("SupplierID") & "" xStr = rst2(1) %> [<%= xStr %>]</TD> <TD><%= rst0("CategoryID") %><% rst1.Filter = "CategoryID = " & rst0("CategoryID") & "" xStr = rst1(1) %> [<%= xStr %>]</TD> <TD><%= rst0("QuantityPerUnit") %></TD> <TD><%= rst0("UnitPrice") %></TD> <TD><%= rst0("UnitsInStock") %></TD> <TD><%= rst0("UnitsOnOrder") %></TD> <TD><%= rst0("ReorderLevel") %></TD> <TD><%= rst0("Discontinued") %></TD> </TR><% rst0.MoveNext Loop rst0.Close rst1.Close rst2.Close Set Conn = nothing %> </TABLE> </BODY> </HTML> |