473,395 Members | 1,652 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,395 software developers and data experts.

Recordsets

Any idea how to produce (query) a recordset from with a recordset using asp

E.G. This is an example:

' start code
sqlstring="select number, title, description, url, cpc, graphic, displayurl
from adverts"
Set Cn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
mdb="c:\databases\db1.mdb")
OpenString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdb &
";Persist Security Info=False"
Cn.Open OpenString
rs.Open SQLString, Cn

' I want to select unique urls from this recordset here
' produce array based on this new recordset

rs.close
set rs = nothing
cn.close
set cn = nothing
' end code

Thanks
Nov 12 '05 #1
4 1458
On Thu, 6 May 2004 16:03:16 +0100, "Vancer" <vgr@[NO
SPAM]vhsholdings.com> wrote:

To get the data you want, the easiest way is to ask for the data you
want.
In this case:
sqlstring="select distinct url from adverts"

Once you have a recordset, the GetString method may be helpful.

-Tom.
Any idea how to produce (query) a recordset from with a recordset using asp

E.G. This is an example:

' start code
sqlstring="select number, title, description, url, cpc, graphic, displayurl
from adverts"
Set Cn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
mdb="c:\databases\db1.mdb")
OpenString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdb &
";Persist Security Info=False"
Cn.Open OpenString
rs.Open SQLString, Cn

' I want to select unique urls from this recordset here
' produce array based on this new recordset

rs.close
set rs = nothing
cn.close
set cn = nothing
' end code

Thanks


Nov 12 '05 #2
Thanks Tom - tried all this but you will find that DISTINCT only works when
querying a single field.

If you try this: sqlstring="select distinct url, number, title, from
adverts" you will get all rows.

Also tried group by (url) but cannot get it to work.

For other reason as well I would like to know how to make a recordset from
an open recordset.

Regards
Vance

"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:f5********************************@4ax.com...
On Thu, 6 May 2004 16:03:16 +0100, "Vancer" <vgr@[NO
SPAM]vhsholdings.com> wrote:

To get the data you want, the easiest way is to ask for the data you
want.
In this case:
sqlstring="select distinct url from adverts"

Once you have a recordset, the GetString method may be helpful.

-Tom.
Any idea how to produce (query) a recordset from with a recordset using asp
E.G. This is an example:

' start code
sqlstring="select number, title, description, url, cpc, graphic, displayurlfrom adverts"
Set Cn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
mdb="c:\databases\db1.mdb")
OpenString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdb &
";Persist Security Info=False"
Cn.Open OpenString
rs.Open SQLString, Cn

' I want to select unique urls from this recordset here
' produce array based on this new recordset

rs.close
set rs = nothing
cn.close
set cn = nothing
' end code

Thanks

Nov 12 '05 #3
On Fri, 7 May 2004 08:22:01 +0100, "Vancer" <vgr@[NO
SPAM]vhsholdings.com> wrote:
Thanks Tom - tried all this but you will find that DISTINCT only works when
querying a single field.

If you try this: sqlstring="select distinct url, number, title, from
adverts" you will get all rows.

Also tried group by (url) but cannot get it to work.

For other reason as well I would like to know how to make a recordset from
an open recordset.
You need a self-join where one of the sides is your original and the
other side is the suggestion previously made.

mike



"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:f5********************************@4ax.com.. .
On Thu, 6 May 2004 16:03:16 +0100, "Vancer" <vgr@[NO
SPAM]vhsholdings.com> wrote:

To get the data you want, the easiest way is to ask for the data you
want.
In this case:
sqlstring="select distinct url from adverts"

Once you have a recordset, the GetString method may be helpful.

-Tom.
>Any idea how to produce (query) a recordset from with a recordset usingasp >
>E.G. This is an example:
>
>' start code
> sqlstring="select number, title, description, url, cpc, graphic,displayurl >from adverts"
> Set Cn = Server.CreateObject("ADODB.Connection")
> Set Rs = Server.CreateObject("ADODB.Recordset")
> mdb="c:\databases\db1.mdb")
> OpenString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdb &
>";Persist Security Info=False"
> Cn.Open OpenString
> rs.Open SQLString, Cn
>
> ' I want to select unique urls from this recordset here
> ' produce array based on this new recordset
>
> rs.close
> set rs = nothing
> cn.close
> set cn = nothing
>' end code
>
>Thanks
>



Nov 12 '05 #4
On Fri, 7 May 2004 08:22:01 +0100, "Vancer" <vgr@[NO
SPAM]vhsholdings.com> wrote:

Your OP says that you want to select unique urls. My code does that.
If you meant something different, ask the different question.

Using ADO you can create a recordset on the fly (CreateObject), add
fields to it (Append), and populate it with data (AddNew).

-Tom.

Thanks Tom - tried all this but you will find that DISTINCT only works when
querying a single field.

If you try this: sqlstring="select distinct url, number, title, from
adverts" you will get all rows.

Also tried group by (url) but cannot get it to work.

For other reason as well I would like to know how to make a recordset from
an open recordset.

Regards
Vance

"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:f5********************************@4ax.com.. .
On Thu, 6 May 2004 16:03:16 +0100, "Vancer" <vgr@[NO
SPAM]vhsholdings.com> wrote:

To get the data you want, the easiest way is to ask for the data you
want.
In this case:
sqlstring="select distinct url from adverts"

Once you have a recordset, the GetString method may be helpful.

-Tom.
>Any idea how to produce (query) a recordset from with a recordset usingasp >
>E.G. This is an example:
>
>' start code
> sqlstring="select number, title, description, url, cpc, graphic,displayurl >from adverts"
> Set Cn = Server.CreateObject("ADODB.Connection")
> Set Rs = Server.CreateObject("ADODB.Recordset")
> mdb="c:\databases\db1.mdb")
> OpenString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdb &
>";Persist Security Info=False"
> Cn.Open OpenString
> rs.Open SQLString, Cn
>
> ' I want to select unique urls from this recordset here
> ' produce array based on this new recordset
>
> rs.close
> set rs = nothing
> cn.close
> set cn = nothing
>' end code
>
>Thanks
>


Nov 12 '05 #5

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

Similar topics

4
by: Marco Alting | last post by:
Is it possible to INNER JOIN two recordsets in ASP? I don't mean the normal JOIN you would use with two tables, but actually join the recordsets in ASP?
2
by: Steve Marciniak | last post by:
I'm trying to display different recordsets (which are 1 field each) as columns right next to one another. For example, Recordset1 is displayed on the left hand side of the screen. Recordset2 is...
6
by: Steve Jorgensen | last post by:
I keep having problems in which ADO disconnected recordset work under some circumstances, but lose all their data at other times, having no rows or fields, though the recordset object still exists....
2
by: Pieter Linden | last post by:
The answer to this one is probably "test it yourself and find out!", but I'll ask anyway. Pursuant to my previous question - sending separate recordsets to Word using the CreateTableFromRecordset...
1
by: lakshmi | last post by:
Hi all, I recently rewrote a data intensive C++ program in C#. The C++ program was traversing 3 recordsets that were all open at the same time. I replaced those 3 recordsets with 3 .NET data...
16
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I asked about how to accomplish same with Oracle and...
24
by: Donald Grove | last post by:
I want to populate an array with values from an ado recordset (multiple rows) I use the absolute position of the cursor in the recordset to define the row of my array to be populated. I have a...
4
by: mrmagoo | last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server database. One of the main goals of the project is to be really responsive to events, such as textbox change events. I...
4
by: rdemyan via AccessMonster.com | last post by:
Can someone help me with creating code that will look for DAO recordsets in modules and then check to see if the recordset is also closed in the module. All of my recordsets are of the form rs*...
11
by: BeckR | last post by:
Hello - Thanks for reading my post. I am a newbie when it comes to VBA programming, but have managed to do what I need to do, until now. I have an Access 2000 database (running WinXP Pro...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.