Advertisement
Guest User

Untitled

a guest
May 16th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 1.67 KB | None | 0 0
  1. <%
  2. Dim dbHost, dbUser, dbPass, dbName
  3. Dim dbConnectionString, dbConnection, dbRecordset, SQL
  4.  
  5. dbHost = "localhost"
  6. dbUser = "root"
  7. dbPass = ""
  8. dbName = "aspairlinessystem"
  9.  
  10.     Set dbConnection = Server.CreateObject("ADODB.Connection")
  11.     Set dbRecordset = Server.CreateObject("ADODB.Recordset")
  12.     dbConnectionString = "DRIVER={MySQL ODBC 5.1 Driver};" &_
  13.                             "SERVER=" & dbHost &_
  14.                             ";DATABASE=" & dbName &_
  15.                             ";UID=" & dbUser &_
  16.                             ";PASSWORD=" & dbPass &_
  17.                             ";OPTION=3;"
  18.     dbConnection.Open dbConnectionString
  19.  
  20.        
  21. 'Connection has been established
  22. %>
  23. <%
  24.         SQL = "SELECT * FROM CustomerInformation"
  25.         dbRecordset.Open SQL, dbConnection
  26.        
  27.         If Not dbRecordset.EOF Then
  28.         %>
  29.         <table border="1">
  30.             <tr>
  31.                 <th>CustomerNo</th><th>CustomerName</th><th>Address</th><th>City</th><th>State</th><th>Country</th><th>PinCode</th><th>EmailID</th><th>Sex</th><th>Age</th><th>Phone</th>
  32.             </tr>
  33.             <%Do While Not dbRecordset.EOF %>
  34.             <tr>
  35.                 <td><%=dbRecordset.Fields("CustomerNo") %></td><td><%=dbRecordset.Fields("CustomerName") %></td><td><%=dbRecordset.Fields("Address") %></td><td><%=dbRecordset.Fields("City") %></td><td><%=dbRecordset.Fields("State") %></td><td><%=dbRecordset.Fields("Country") %></td><td><%=dbRecordset.Fields("PinCode") %></td><td><%=dbRecordset.Fields("EmailID") %></td><td><%=dbRecordset.Fields("Sex") %></td><td><%=dbRecordset.Fields("Age") %></td><td><%=dbRecordset.Fields("Phone") %></td>
  36.             </tr>
  37.             <%dbRecordset.MoveNext
  38. Loop %>
  39.         </table>
  40.         <%Else %>
  41.         No Records Defined
  42.         <%End If %>
  43. <%
  44. If ddRecordset.State <> 0 Then
  45.     dbRecordset.Close
  46.     Set dbRecordset = Nothing
  47. End If
  48. dbConnection.Close
  49. Set dbConnection = Nothing
  50. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement