Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web
Expertise: Intermediate
Oct 5, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Using Recordset::GetString()

You can use GetString() method of ADODB.Recordset object if you want to dump the complete table in an active server page. GetString() method returns the complete recordset as a string. You can specify the number of rows in the recordset to return. All rows will be returned if this parameter is not specified, or if it is greater than the number of rows in the recordset. You can also specify the delimiters to use between various columns and the rows. You can use this method to build an HTML table in an asp page. To build an HTML table using this method you need to specify the combination of "<TD>" and "<TR>" tags in column and row delimiters.

Here is the sample VBScript code from an active server page which can be used to build an HTML table.

 Dim oConnection ' Connection Object
 Dim oRecordset ' Recordset Object

 ' Create connection and recordset object
 Set oConnection = Server.CreateObject("ADODB.Connection")
 Set oRecordset  = Server.CreateObject("ADODB.Recordset")

 ' Open the connection object
 oConnection.Open "DSN=Sample","sa",""
 ' Open the recordset object
 oRecordset.Open "MyTable", oConnection,,,adCmdTable

 ' Write the complete table using GetString() method
 Response.Write "<TABLE BORDER=1><TR><TD>"
 Response.Write oRecordset.GetString(,,"</TD><TD>", "</TD></TR><TR><TD>")
 Response.Write "</TD></TR></TABLE>"
Deepak Pant
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date