Long island web design, hosting company
Home About Us Support Products Services Portfolio Contact Us Home

ASP > Using GetRow

Created On: 11/24/2004 9:59:00 AM

Following example,  extracts all of the records in a database table and stores into a 2-dimensional array. This gives you an advantages to modify and work on data.
<%
 Set cn = server.createobject("adodb.connection")
 cn.open "Provider=SQLOLEDB;Server=ASP;User ID=sa;Password=;Database=Northwind;"
 set rs = cn.execute("select LastName, FirstName from Employees")
 dbArray = rs.GetRows()

 for i = 0 to ubound(dbArray, 2)
  response.write dbArray(0, i) & ",&nbsp; "
  response.write dbArray(1, i) & "<br>"
 next
%>