Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populating recordset with array? 1

Status
Not open for further replies.

mmaz

Programmer
Nov 22, 2000
347
0
0
Is it possible to create a recordset and populate it with an array? If so, what is the syntax?

Thanks!

Marie
 
Are you creating the RecordSet for the purpose of inserting records into a Database? If so then I suggest going with a straight SQL Statement sent to the RDBMS, much easier (IMO) and more efficient. Wushutwist
 
Some quick and dirty code

<%
Dim myarr 'for storing array
Dim rs 'for recordset

'Initialization
myarr = Array (1, &quot;John&quot;, &quot;Smith&quot;, 33, 20000)
rs = CreateObject(&quot;ADODB.Recordset&quot;)

'Recordet is populated with whole array
rs = myarr

'Some output for testing

Response.Write &quot;<b>Array</b>&quot; & &quot;<br>&quot; & VBCrLf
for i = 0 to 4
Response.Write myarr(i) & &quot; &quot;
next
Response.Write &quot;<br>&quot; & VBCrLf

Response.Write &quot;<b>Recordset</b>&quot; & &quot;<br>&quot; & VBCrLf
for i = 0 to 4
Response.Write rs(i) & &quot; &quot;
next

%>

See if suits your needs.
D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top