here's the code for one of the first asp pages I ever wrote, warts and dev
notes included:
(if the net nanny lets it thru <g>) - monospace preferred...

<%@ LANGUAGE="VBSCRIPT" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>

<head>
<meta HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<title>VFP ASP ADO Test</title>
</head>

<body>

<h3>ActiveX Data Object (ADO)</h3>
<%

   Const adOpenForwardOnly = 0
   Const adOpenKeyset  = 1
   Const adOpenDynamic = 2
   Const adOpenStatic = 3
   Const adOpenUnspecified = -1

   Const adLockReadOnly = 1
   Const adLockPessimistic = 2
   Const adLockOptimistic = 3
   Const adLockBatchOptimistic = 4
   Const adLockUnspecified = -1

   Const adCmdText = 1
   Const adCmdTable = 2
   Const adCmdStoredProc = 4
   Const adCmdUnknown = 8

   Set Conn = Server.CreateObject("ADODB.connection")
   ConnStr= "Driver=Microsoft Visual Foxpro Driver; " + _
   "UID=;SourceType=DBC;SourceDB=C:\VFP\Samples\Tastrade\Data\Tastrade.dbc"
   Conn.Open ConnStr   'This can be a datasource name or a connect string
   Set cmdTemp = Server.CreateObject("ADODB.Command")
   Set rs = Server.CreateObject("ADODB.Recordset")
   SQLText="Select Distinct Products.Product_ID,Products.Product_Name,"+ _
      "Products.English_Name,Products.Unit_Price, " + _
      "Products.Quantity_In_Unit from Tastrade!Products"

   ' This works:
'   cmdTemp.CommandText = SQLText
'   cmdTemp.CommandType = 1 'SQL statement
'   Set cmdTemp.ActiveConnection = Conn
'   rs.CacheSize = 10
'   rs.Open cmdTemp,,adopenstatic

'   and this:
'    rs.Open SQLText, Conn, adOpenKeyset, adLockPessimistic, adCmdText

'   and this:
'    rs.Open SQLText, Conn, adOpenKeyset, adLockOptimistic, adCmdText

'   and this works:
'    rs.Open SQLText, Conn, adOpenStatic, 3, adCmdText

    rs.Open SQLText, Conn, adOpenStatic, adLockReadOnly, adCmdText

   %>

<table BORDER="1">
  <tr>
<% For i = 0 to RS.Fields.Count - 1 %>
    <td><b><% = RS(i).Name %></b></td>
<% Next %>
  </tr>
<% Do While Not RS.EOF %>
  <tr>
<% For i = 0 to RS.Fields.Count - 1 %>
    <td VALIGN="TOP"><% = RS(i) %>
</td>
<% Next %>
  </tr>
<%
        RS.MoveNext
   Loop
   rs.MoveFirst()

  ' rs.Fields("unit_price").Value = "18.18"
   ' Save the changes you made to the
   ' current record in the Recordset
  ' rs.Update()

   rs.close

   Conn.Close
   %>
</table>

<p><br>
<br>
</p>
</body>
</html>


Andrew Davies  MBCS CITP
  - AndyD        8-)#



**********************************************************************

Manchester City Council supports Smokefree England - 1 July 2007


This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error please notify the system manager.

This footnote also confirms that this email message has been swept by 
MIMEsweeper for the presence of computer viruses.

Please contact [EMAIL PROTECTED] with any queries.

**********************************************************************



_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to