how to save a recordset to an array 
Author Message
 how to save a recordset to an array

I make a Recordset "rs", and I have calculated the number of records on
"RecNB" the following Javascript code doesn't work on <%rs.MoveNext%>

 T = new Array();
 for(i=0;i<<%=RecNB%>;i++)
 {
  T[i] = '<%=rs(0)%>';
   <%rs.MoveNext%>
 }

Anyone knows how to save a recordset's filed in an array on client site. In
my example all T[i] values are the same the first rs(0).
Any help would be really appreciated



Sat, 17 May 2003 03:00:00 GMT  
 how to save a recordset to an array

Hi

Assuming a rs

<script type="text/JavaScript">
<%
var cnt = 0;
var theData = "var myArr = new Array();";

  while(!rs.EOF)
         {
          theData += "myArr[" + cnt++ +"]='" + rs("bla").value + "';";
          rs.MoveNext();
         }
  rs.Close();
Response.Write( theData );
%>
</script>
--
--
Best Regards
  Vidar Petursson
 ==============================
   Microsoft Internet, Client, SDK MVP
 ==============================
 http://www.icysoft.com
 http://www.dna.is



 ==============================
  No matter where you go there you are
 ==============================
--


Quote:
> I make a Recordset "rs", and I have calculated the number of records on
> "RecNB" the following Javascript code doesn't work on <%rs.MoveNext%>

>  T = new Array();
>  for(i=0;i<<%=RecNB%>;i++)
>  {
>   T[i] = '<%=rs(0)%>';
>    <%rs.MoveNext%>
>  }

> Anyone knows how to save a recordset's filed in an array on client site.
In
> my example all T[i] values are the same the first rs(0).
> Any help would be really appreciated



Sat, 17 May 2003 03:00:00 GMT  
 how to save a recordset to an array

Vidar,
Thank you for your reply, but I still can not make it to work.
I used Javascript as server script and made the recordset as the follow;
var ind = 0
var vbImg = "var Imgs = new Array();";
while(! rs.EOF )
{
 vbImg +=  "Imgs[" + ind++ + "]='" + rs("picAdd").value + "';"
 rs.MoveNext();

Quote:
}

 Response.Write(vbImg);
%>
It writes correctly the vbImg, and I have the array's declaration, and
correct values for each Imgs[]. Now How can i use this array on Client side
with JavaScript. For example how can I make this function runs correctly
function ShowSlides(I)
{
 document.myPicture.src=Imgs[I];
Quote:
}

Thank you again for your help.


Quote:
> Hi

> Assuming a rs

> <script type="text/JavaScript">
> <%
> var cnt = 0;
> var theData = "var myArr = new Array();";

>   while(!rs.EOF)
>          {
>           theData += "myArr[" + cnt++ +"]='" + rs("bla").value + "';";
>           rs.MoveNext();
>          }
>   rs.Close();
> Response.Write( theData );
> %>
> </script>
> --
> --
> Best Regards
>   Vidar Petursson
>  ==============================
>    Microsoft Internet, Client, SDK MVP
>  ==============================
>  http://www.icysoft.com
>  http://www.dna.is



>  ==============================
>   No matter where you go there you are
>  ==============================
> --



> > I make a Recordset "rs", and I have calculated the number of records on
> > "RecNB" the following Javascript code doesn't work on <%rs.MoveNext%>

> >  T = new Array();
> >  for(i=0;i<<%=RecNB%>;i++)
> >  {
> >   T[i] = '<%=rs(0)%>';
> >    <%rs.MoveNext%>
> >  }

> > Anyone knows how to save a recordset's filed in an array on client site.
> In
> > my example all T[i] values are the same the first rs(0).
> > Any help would be really appreciated



Sat, 17 May 2003 03:00:00 GMT  
 how to save a recordset to an array
Hi

If I is valid , also you may need to add the path

document.images[ "imageID" ].src = "/images/" + Imgs[I];

--
--
Best Regards
  Vidar Petursson
 ==============================
   Microsoft Internet, Client, SDK MVP
 ==============================
 http://www.icysoft.com
 http://www.dna.is



 ==============================
  No matter where you go there you are
 ==============================
--


Quote:
> Vidar,
> Thank you for your reply, but I still can not make it to work.
> I used Javascript as server script and made the recordset as the follow;
> var ind = 0
> var vbImg = "var Imgs = new Array();";
> while(! rs.EOF )
> {
>  vbImg +=  "Imgs[" + ind++ + "]='" + rs("picAdd").value + "';"
>  rs.MoveNext();
> }
>  Response.Write(vbImg);
> %>
> It writes correctly the vbImg, and I have the array's declaration, and
> correct values for each Imgs[]. Now How can i use this array on Client
side
> with JavaScript. For example how can I make this function runs correctly
> function ShowSlides(I)
> {
>  document.myPicture.src=Imgs[I];
> }
> Thank you again for your help.



> > Hi

> > Assuming a rs

> > <script type="text/JavaScript">
> > <%
> > var cnt = 0;
> > var theData = "var myArr = new Array();";

> >   while(!rs.EOF)
> >          {
> >           theData += "myArr[" + cnt++ +"]='" + rs("bla").value + "';";
> >           rs.MoveNext();
> >          }
> >   rs.Close();
> > Response.Write( theData );
> > %>
> > </script>
> > --
> > --
> > Best Regards
> >   Vidar Petursson
> >  ==============================
> >    Microsoft Internet, Client, SDK MVP
> >  ==============================
> >  http://www.icysoft.com
> >  http://www.dna.is



> >  ==============================
> >   No matter where you go there you are
> >  ==============================
> > --



> > > I make a Recordset "rs", and I have calculated the number of records
on
> > > "RecNB" the following Javascript code doesn't work on <%rs.MoveNext%>

> > >  T = new Array();
> > >  for(i=0;i<<%=RecNB%>;i++)
> > >  {
> > >   T[i] = '<%=rs(0)%>';
> > >    <%rs.MoveNext%>
> > >  }

> > > Anyone knows how to save a recordset's filed in an array on client
site.
> > In
> > > my example all T[i] values are the same the first rs(0).
> > > Any help would be really appreciated



Sun, 18 May 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Saving recordsets to XML

2. ADO Saved Recordset: adPersistADTG vs adPersistXML speed

3. Save a Date/Time field in a Recordset

4. Recordset size and arrays

5. Array or Recordset?

6. Recordset to an array

7. Pass javascript array to a ASP recordset

8. Disconnected recordset vs. array

9. Weird array/recordset stuff?

10. Type mismatch transferrring recordset to array?

11. Sorting recordset or array

12. recordset into 2d array using getrows()

 

 
Powered by phpBB® Forum Software