943,987 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 18363
  • ASP RSS
Oct 25th, 2004
0

using asp array to store db information

Expand Post »
undefinedhi,
I am new to asp and trying to get information from a table and make an array of it using an asp variable and then use it for further processing .
The problem is the my sql query returns data this way
Id
16
27
95
97
90,89,65,45,44
78
87
93

I need to get all these values(which includes all the comma separated .I need to use this information in another sql query which then returns me more info
is this possible?
The next table has more information on this column with which i can eliminate the duplicate and extra values.

Thanks,
arthi
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
arthi is offline Offline
1 posts
since Aug 2004
Oct 26th, 2004
0

Re: using asp array to store db information

If you collect the result set from your first query into a coma separated string as follows:

16,27,95,97,90,89,65,45,44,78,87,93

then, you can then embed this string in the second query as follows:

select * from your_second_table where id in ( 16,27,95,97,90,89,65,45,44,78,87,93)

The only problem with this is that the second query will fail if you have too many items in the list (Max number depends on your DB). The better solution would be to design the tables so you could join the two tables in a single query. The only problem I see for you is you have a column that has multiple values in it (poor design).

If you provide more details on the layout of the tables and the queries you are running, I might be able to give you more specific advice.

Quote originally posted by arthi ...
undefinedhi,
I am new to asp and trying to get information from a table and make an array of it using an asp variable and then use it for further processing .
The problem is the my sql query returns data this way
Id
16
27
95
97
90,89,65,45,44
78
87
93

I need to get all these values(which includes all the comma separated .I need to use this information in another sql query which then returns me more info
is this possible?
The next table has more information on this column with which i can eliminate the duplicate and extra values.

Thanks,
arthi
Reputation Points: 10
Solved Threads: 1
Newbie Poster
jwstickley is offline Offline
7 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: new and in need
Next Thread in ASP Forum Timeline: How do I get the Description attribute in Windows Media Player using ASP?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC