Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2005, 08:37 AM
Registered User
 
Join Date: May 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Random Number Creation

Hi,

I;m trying to create a series of 4 random 8 digit numbers, checking to see they haven't already been created and then insert them into a database.

While I'm ok creating the numbers I'm having difficulty checking them against the values already in the database can anyone give me a few tips?

Cheers

Mike

 
Old June 7th, 2005, 12:08 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

how are u checking it in the database??

Regards
Ganesh
 
Old June 21st, 2005, 12:54 PM
Authorized User
 
Join Date: Mar 2005
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aehb
Default

I'll suppose that you use SQL Server or Access database,
you can check the occurences of the value using the SELECT command,
for example:-

commandString = "SELECT num from numTable where num = '" + myNum
      + "'";
and then check the number of rows in the resulting dataTable.

You must know first how to connect to a database and make queries.

Hope that helps :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Random Number Generation i_shahid C# 2005 2 March 31st, 2008 10:50 PM
random number rajuru Beginning PHP 7 December 7th, 2004 10:52 AM
random number isheikh PHP How-To 1 October 25th, 2004 08:43 PM
Random Number Blaise Access 5 August 23rd, 2003 06:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.