|
The ProgrammingMSAccess.COM Site An ASP script for publishing data from the authors table in the sql server pubs database. this script follows from a modification to the automatically generated one from the access 2000 file > export command. an article that i wrote for the tech republic site (www.techrepublic.com) explains how to transform an automatically generated script for publishing an access table to a custom one for publishing a sql server table.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Shippers</title> <meta name="Microsoft Theme" content="blends 001"> </head> <body><% If IsObject(Session("pubs_conn")) Then Set conn = Session("pubs_conn") Else Set conn = Server.CreateObject("ADODB.Connection") conn.open "Provider=sqloledb;data source = cab2200;" & _ "user id = sa; initial catalog =pubs" Set Session("pubs_conn") = conn End If %> <% If IsObject(Session("authors_rs")) Then Set rs = Session("authors_rs") Else sql = "SELECT * FROM authors" Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sql, conn, 3, 3 If rs.eof Then rs.AddNew End If Set Session("authors_rs") = rs End If %> <TABLE BORDER=1 BGCOLOR=#ffffff CELLSPACING=3><FONT FACE="Arial" COLOR=#000000><CAPTION><B>Authors</B></CAPTION></FONT> <THEAD> <TR> <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial" COLOR=#000000>First Name</FONT></TH> <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial" COLOR=#000000>Last Name</FONT></TH> <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial" COLOR=#000000>Phone</FONT></TH> </TR> </THEAD> <TBODY> <% On Error Resume Next rs.MoveFirst do while Not rs.eof %> <TR VALIGN=TOP> <TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("au_fname").Value)%><BR></FONT></TD> <TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("au_lname").Value)%><BR></FONT></TD> <TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("phone").Value)%><BR></FONT></TD> </TR> <% rs.MoveNext loop%> </TBODY> <TFOOT></TFOOT> </TABLE></body> </html>
Want to understand Microsoft Access 2000 so that you can program it to do more tasks like this? Get Programming Microsoft Access 2000 by Rick Dobson from Microsoft Press. Learn more about the book by clicking here. Copyright 1999 CAB, Inc. All rights reserved. Republication or redistribution
of CAB, Inc. content, including by framing or similar means, is expressly
prohibited without the prior written consent of CAB, Inc. CAB, Inc. shall not be
liable for any errors in the content, or for any actions taken in reliance
thereon. |