borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Layered windows & .Png\'s)Next Topic (how to make label sizes dynamic within a frame) New Topic New Poll Post Reply
AndreaVB Forum : VB General : forcing restriction in number of records returned by a query
Poster Message
maheeru
Level: Sage

Registered: 13-04-2005
Posts: 60

icon forcing restriction in number of records returned by a query

1)Is there any way to force restriction on a recordset object so that a query returns 'x' number of records only.  Say if 10 records exist in a particular category and I want
only 3 or 4 or 7 how to enforce the restriction in a query.  It seems that Top clause will not be efficient here as it will return the number of records existing according to sorting criteria. But I will not use orderby clause here. Is there anything better  than top clause? What is a work around to use Distinct keyword with a field, with Top clause as it gives syntax error.
Is there any way out here?

2)Does Microsoft.jet.oledb4.0 provider support multiple recordset management(i.e multiple queries separated by ;)

09-05-2005 at 06:49 AM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: forcing restriction in number of records returned by a query

The SELECT TOP is the only way for MSSQL I believe, even with Access, or mySQL there's not really any other way...

Of course I think the reason is, there's no way for the SQL server to know WHAT you want to return the top of, until you specify the conditions, and/or orderby.



Jet may have supported it... but I wouldn't do it offhand though... depending on how, it would leave you open to malicious uses -- it may have been disabled... or still might work, try it and see -- although if you're executing different commands, just use the connection object's .Execute command, or other way.

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

09-05-2005 at 07:36 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
maheeru
Level: Sage

Registered: 13-04-2005
Posts: 60
icon Re: forcing restriction in number of records returned by a query

Thanx for your reply.

My jet does not support multiple query.(its 4.0).  I use recordset.open "query"

13-05-2005 at 01:50 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : forcing restriction in number of records returned by a query
Previous Topic (Layered windows & .Png\'s)Next Topic (how to make label sizes dynamic within a frame) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder