Interview Questions

How do you create a recordset object in VBScript?

ASP Interview Questions and Answers


(Continued from previous question...)

122. How do you create a recordset object in VBScript?

Answer1
//First of all declare a variable to hold the Recordset object, ex-
Dim objRs
//Now, Create this varible as a Recordset object, ex-
Set objRs=Server.CreateObject(ADODB.RECORDSET)

Answer2
” rs.MoveNext
wend
end if
%’>
*. Create Recordset object
*. Place form field value in a variable named “param”
*. Define query by concatenating strings and variable value
*. Open RecordSet Object. Note that the first parameter is the Command Text. The second parameter is the Connection String. The Command Object and Connection Object are created implicitly.
*. Make sure the RecordSet isn’t empty
*. Begin executing a loop which goes through all records in the RecordSet.
*. Write each record’s “firstname” and “lastname” fields to the page on a separate line.
*. Move to Next Record.

(Continued on next question...)

Other Interview Questions