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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am attempting to populate an arra

Status
Not open for further replies.

rich0335

Programmer
Oct 16, 2001
5
US
I am attempting to populate an array from a MS SQL table. I'm able to make a connection to the database, but I'm not sure I am loading the array correctly because the elements return as null. Does anyone know how to load an array from a table?? Thank you.

Below is my code:

<%
var contTparray = new Array();
var CmdJobTp = Server.CreateObject( &quot;ADODB.Command&quot; );
var Con = Server.CreateObject( &quot;ADODB.Connection&quot; );
Con.Open( Session(&quot;ConnectionString&quot;) ) ;
CmdJobTp.ActiveConnection = Con;
CmdJobTp.CommandText = &quot;{call ddlbJobTp(?)}&quot;;
CmdJobTp.Parameters.Append( CmdJobTp.CreateParameter( &quot;sMsg&quot;, adChar, adParamOutput, 255, &quot;&quot; ) );
var rsJobTp = CmdJobTp.Execute();
var liCount=rsJobTp.RecordCount
var i=0;
while (! rsJobTp.EOF)

{
contTparray = rsJobTp(&quot;conttp&quot;)
i++
rsJobTp.moveNext();

}


rsJobTp = null;
CmdJobTp = null;
Con.Close();
Con=null;


%>
 
contTparray = rsJobTp(&quot;conttp&quot;)

just forgot your element there

:)
paul
penny.gif
penny.gif
 
That was a typo when I created this thread, it still returns a mull value with the after the array name.
 
with the GetRows method, you can create a 2 dimensional array from your recordset...

contTparray = rsJobTp.GetRows

contTparray(x,y) - x is the field offset per record
y is the record offset for the recordset



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top