Web Design Australia Brisbane - SiteDesignNOW Logo
 
 
Web Products and Services - eCommerce systems

 
Web Site Projects

Web Development Australia - Mr Toys Toyworld
MrToys - eCommerce Website

Web Development Australia - Clockshop
Clockshop - eCommerce Website

Web Development Australia - PetCity
PetCity - eCommerce Website

Web Development Australia - PetCity
Roses Direct - eCommerce Website

Web Development Australia - Top Rider
Top Rider - eCommerce Website

Web Development Australia - Logan Chamber of Commerce
Logan Chamber of Commerce - Community Website

Web Development Australia - Grey Nomads Employment
Grey Nomads Employment - Community Website

Web Development Australia - Mutts Be Luv
Mutts Be Luv - eCommerce Website


Web Development Australia - Logan Country Chamber of Commerce
Logan Country Chamber of Commerce - Community Website

Web Development Australia - Quilting Patchwork
Quilting Patchwork - eCommerce Website

more projects

Make your enquiry for web development
Enquiry Form

 

 

ASP - Recordset GetRows Method

The GetRows method of the Recordset object lets you retrieve the resultset and place into a two-dimensional array. The code below then loops through that 2 dimensional array 'ArrResults' and displays the records.

The standard way to retrieve and display records has been to create a recordset object and loop through the records, though with the GetRows method there is only one call to the database making for more efficient code.

We use the UBound function which returns the index of the highest element in the array for both dimensions, this basically lets us know how many times to loop through both the rows and columns.

<%
'Declare Variables
Dim oConnection, oRecordset
Dim sConnString, sSQL
Dim arrResults
Dim iRowNumber, iColumnNumber
Dim RowCounter, ColumnCounter

'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("Users.mdb")

'Create our connection objection
Set oConnection = Server.CreateObject("ADODB.Connection")
'Open the connection to the database
oConnection.Open(sConnString)

'declare SQL statement that will query the database
sSQL = "SELECT * FROM users_tbl"

'create and fill our recordset object
Set oRecordSet = oConnection.Execute(sSQL)

If Not oRecordSet.EOF Then
'Get all the records and assign to arrResults variable
arrResults = oRecordSet.GetRows()

'Close the connection and recordset objects
oRecordset.Close
Set oRecordSet = Nothing
oConnection.Close
Set oConnection = Nothing

' Retrieve the total no. of rows (second dimension of the array)
iRowNumber = ubound(arrResults,2)
'Retrive the total no. of columns/fields (first dimension of the array)
iColumnNumber = ubound(arrResults,1)

'Loop through the array holding the resultset and display records
'Loop through rows as the outer loop
For RowCounter=0 to iRowNumber
   'Loop through columns/fields as inner loop
   For ColumnCounter= 0 to iColumnNumber
   Response.Write(arrResults(ColumnCounter,RowCounter)) & " "
   Next 'Move on to next column/field is there is one
   Response.write("<br />")
Next 'Move on to next row if there is one

Else
   Response.write("There are no records.")
End If
%>

Source from CodeFixer
http://www.codefixer.com/codesnippets/getrows_recordset_method.asp

 

Web Products and Services - eCommerce systems

Web Email Newsletter System Australia Brisbane Sample Mr Toys Toyworld
Mr Toys Toyworld

Web Email Newsletter System Australia Brisbane Sample Logan Chamber of Commerce
Logan Chamber of Commerce

Web Email Newsletter System Australia Brisbane Sample Focus By James
Focus by James Restaurant



Web Profitable Articles AUstralia Brisbane
> Is Your eCommerce Website Giving Visitors The Right Message?
> How your local business can make money on the web?
> Critical website considerations you need to know
> The benefits of choosing SiteDesignNOW to develop your website
> How using Autoresponders can slash your advertising budget
> Choosing the right ONLINE Catalogue and eCommerce System
> Customer Relationship Management for Local Business
> Give your cashflow an adrenlin boost
> Nine tips to attract more online business
> Does My Local Business Need a Website?
> How online catalogues and e-commerce systems can change the dynamics of your business
> How small businesses use the internet to drive traffic and improve their cashflow....
> Why small businesses have such a hard time turning their website into a profit centre - and how you can fix it in no time flat!

PAY ONLINE
Using eWay
Secure Payment Gateway (AUD)
National Bank Payment Gateway

PAY ONLINE
Using PAYPAL Gateway
(USD, AUD)

PayPal


Make your enquiry for web development
Enquiry Form
 
Web eLearning Center - Tutorials
Creating a NEW email account in OUTLOOK
Setting up your email accounts in OUTLOOK Express
Changing EXISTING email addresses in OUTLOOK
Modify Cookie settings
Flush DNS resolver on your local PC (Windows)
Transfer email names from OUTLOOK to an Excel
Retrieving Mail from Mail Server
How to resize your pictures in PhotoShop
How to resize your pictures using IRFRANView
How to centre images in PhotoShop
Converting Bitmaps Images to Jpeg and Gif format
Linking to PDF or Word.doc
EXPORT CONTACT LIST FROM OUTLOOK TO AN EXCEL
ASP - Recordset GetRows Method
Copyright © 1997 - 2010 SiteDesignNOW – All rights reserved.
Last Update: 9/8/2010
As Featured On Ezine Articles