DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 21 Aug 2007 09:34:07 -0000,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    dungdang
          2    unknown
          3    dungdang
          4    DC


Select a Random Number from MSAccess Table Using C#   
Hello,
I want to use C# to select a random number from MS Access database
table.
<SELECT TOP 1 userID FROM users ORDER BY NEWID()>  seem to work only
with SQL Server.

dungdang
Date:Tue, 21 Aug 2007 09:34:07 -0000   Author:  

Re: Select a Random Number from MSAccess Table Using C#   
You may be better off asking directly in an Access group, however, you
could do this directly in your Access query by using the RND function
in conjunction with a calculation on a field e.g.

SELECT TOP 1  Rnd(Len([LastName])) AS Expr1, LastName
FROM Employees
ORDER BY Rnd(Len([LastName])) DESC;
Date:Tue, 21 Aug 2007 02:48:23 -0700   Author:  

Re: Select a Random Number from MSAccess Table Using C#   
the On Aug 21, 9:48 am, "ca8...@aspnetlibrary.com"
 wrote:

> You may be better off asking directly in an Access group, however, you
> could do this directly in your Access query by using the RND function
> in conjunction with a calculation on a field e.g.
>
> SELECT TOP 1  Rnd(Len([LastName])) AS Expr1, LastName
> FROM Employees
> ORDER BY Rnd(Len([LastName])) DESC;



I've this method also, on the Access it works fine..but on C# code
(WinForm), it keeps constatntly picking the same number again and
again..
Date:Tue, 21 Aug 2007 13:01:26 -0000   Author:  

Re: Select a Random Number from MSAccess Table Using C#   
dungdang wrote:

> Hello,
> I want to use C# to select a random number from MS Access database
> table.
> <SELECT TOP 1 userID FROM users ORDER BY NEWID()>  seem to work only
> with SQL Server.
> 
> dungdang
> 


Do you use the "randomise" function befor using RND? if not then you 
will always get the same "random" number as you are not getting the 
clock to seed the RND function.

Luck,
Date:Wed, 22 Aug 2007 12:07:23 +0100   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us