devxlogo

Using Recordset::GetString()

Using Recordset::GetString()

You can use GetString() method of ADODB.Recordset object if you want to dumpthe complete table in an active server page. GetString() method returns thecomplete recordset as a string. You can specify the number of rows in therecordset to return. All rows will be returned if this parameter is notspecified, or if it is greater than the number of rows in the recordset. Youcan 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 anHTML table using this method you need to specify the combination of “” and “” tags in column and row delimiters.

Here is the sample VBScript code from an active server page which can beused 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 "
" Response.Write oRecordset.GetString(,,"", "
") Response.Write "
"%>
See also  Monetize TikTok For Your Business
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist