home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_05.cab / script6.asp < prev    next >
Text File  |  1997-08-07  |  2KB  |  47 lines

  1. <form method="Post" Action="iiatmd2.asp#select">
  2.     <input type="hidden" name="ShowData" value="True"><p align="center"><input type="Submit" Value="Show Me"></p>
  3. </form>
  4.  
  5. <% If Request.Form("ShowData") = "True" then
  6. 'Find the physical path for the file in the current directory. 
  7. MainPath = Request.ServerVariables("PATH_TRANSLATED")
  8.  
  9. 'Determine the path for the current page and then remove the
  10. 'name of the file from the path (leaving just the directory).
  11. Length = Len(MainPath)
  12.  
  13. i = 0
  14. Do Until (i  = 2)
  15.   Do While (Mid(MainPath, Length, 1) <> "\")
  16.     Length = Length - 1      
  17.   Loop  
  18. i = i + 1
  19. MainPath = left(MainPath, (Length-1)) 
  20. Loop
  21. FilePath = left(MainPath, Length) + "\tutorial\"
  22.  
  23.  strSource = "DRIVER=Microsoft Access Driver (*.mdb);UID=admin;FIL=MS Access;DBQ="&FilePath&"BTCustmr.mdb"
  24. Set dbConnection = Server.CreateObject("ADODB.Connection")
  25. dbConnection.Open strSource
  26. SQLQuery = "SELECT * FROM Customers"
  27. Set rsCustomerList = dbConnection.Execute(SQLQuery)
  28.  
  29. %>
  30. <Center>
  31. <TABLE BORDER=1>
  32. <% Do While Not rsCustomerList.EOF %>
  33. <TR><TD width=105><% = rsCustomerList("ContactFirstName")  %></TD><TD width=105><%= rsCustomerList("ContactLastName") %></TD><TD width=110><% = rsCustomerList("City") %></TD><TD width=27><% = rsCustomerList("StateOrProvince") %></TD></TR>
  34. <%   rsCustomerList.MoveNext 
  35.    Loop %>
  36. </TABLE>
  37. </Center>
  38. <% Else %>
  39. <Center>
  40. <TABLE BORDER=1>
  41. <TR><TD width=105> </TD><TD width=105> </TD><TD width=110> </TD><TD width=27><BR></TD></TR>
  42. <TR><TD width=105> </TD><TD width=105> </TD><TD width=110> </TD><TD width=27><BR></TD></TR>
  43. <TR><TD width=105> </TD><TD width=105> </TD><TD width=110> </TD><TD width=27><BR></TD></TR>
  44. </Table>
  45. </Center>
  46. <%End if%>
  47.