473,326 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

SQL data into array

hay, i'm new to ASP, worked mostly with php, so here's my question.

i take data from the sql server like this:

....
set con=Server.CreateObject("adodb.connection")
set rs=Server.CreateObject("adodb.recordset")

SqlExp = "SELECT * FROM content"
rs.Open SqlExp,con,3,3

Response.Write rs("PageName")
....

now, sure it works nice with only one row, but if i have several row in
my Table, my guess i need to put data into an array?

so, how do i put my fields into an array and display them?

Nov 7 '06 #1
2 9254

"Igal" <ig********@gmail.comwrote in message
news:11*********************@e3g2000cwe.googlegrou ps.com...
hay, i'm new to ASP, worked mostly with php, so here's my question.

i take data from the sql server like this:

...
set con=Server.CreateObject("adodb.connection")
set rs=Server.CreateObject("adodb.recordset")

SqlExp = "SELECT * FROM content"
rs.Open SqlExp,con,3,3

Response.Write rs("PageName")
...

now, sure it works nice with only one row, but if i have several row in
my Table, my guess i need to put data into an array?

so, how do i put my fields into an array and display them?
you can simply loop thought the recordset like this

do until rs.eof
reponse.write rs("PageName")
rs.MoveNext
loop
or you can put the records set into a array like this

myArray = rs.gerRows()

Nov 7 '06 #2
Igal wrote:
hay, i'm new to ASP, worked mostly with php, so here's my question.

i take data from the sql server like this:

...
set con=Server.CreateObject("adodb.connection")
set rs=Server.CreateObject("adodb.recordset")

SqlExp = "SELECT * FROM content"
rs.Open SqlExp,con,3,3

Response.Write rs("PageName")
...

now, sure it works nice with only one row, but if i have several row
in my Table, my guess i need to put data into an array?

so, how do i put my fields into an array and display them?
My advice would be to avoid the recordset loop and use the GetRows, or
GetString approach whenever possible:
http://databases.aspfaq.com/database...getstring.html

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Nov 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I had some code that worked fine for several weeks, and then yesterday it stopped working. I'm not sure what I did. Nor can I make out why it isn't working. I'm running a query that should return 3...
2
by: jerrygarciuh | last post by:
Hello, In this sample script I create an array of objects. Print out their data with print_r().Update their data with a sub called v_set(). Print out data showing the chnages using print_r(). I...
4
by: Michael Kirchner | last post by:
Hi everybody The output of my multiple dimension array is quite confusing. Im declaring an array, store some values in it and then I save the array in a session variable. On an other page I...
8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
5
by: Kutty Banerjee | last post by:
hi , i ve int (*Data); int A={1,2,3,4}; Data=&A; //Question here, how d i dynamically allocate space for Data using calloc? printf("%d\n",*Data) ; //gives 1 //But printf("%d\n",*Data)...
10
by: Bart Goeman | last post by:
Hi, I have a question about how to put redundant information in data structures, initialized at compile time. This is often necessary for performance reasons and can't be done at run time (data...
1
by: becca0619 | last post by:
Hey, Ive been looking around to find out how to read data into a 2D array and I cant find a solution that will fit my assignment. Im not sure that I should even use an array actually... ok so...
8
by: brainflakes.org | last post by:
Hi guys, I need to manipulate binary data (8 bit) stored in a 2 dimensional array. I've tried various methods (arrays, using a string filled with chr(0), using gd lib) and so far the fastest...
5
KevinADC
by: KevinADC | last post by:
Introduction This discussion of the sort function is targeted at beginners to perl coding. More experienced perl coders will find nothing new or useful. Sorting lists or arrays is a very common...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.