Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to assign next seq no.
Message
De
08/03/2007 11:16:35
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01201365
Message ID:
01201943
Vues:
14
Gerard,

Since it looks like you're using SQL Server, I'd use a Stored Proc to handle the stuff with the Numbers table and return the next available number.

~~Bonnie



>Hi.
>I have a form (Windows C#) which has a no. of fields on it, one field (Dept)which will be used as a key into a Numbers file, to assign next available sequential number for the particular department.
>I also have a numbers file with just two fields:
>Dept
>PrevNum
>..use to hold Prev sequential number for each department
>
>
>What I want to do is:
>Do a lookup on the Numbers File using the Dept as a Key
>If it exists, add 1 to PrevNum, replace it and use this as the next number
>If it does not exist, append record to Numbers file and move 1 into it
>
>I could do this in a few mins in VFP but would appeciate some assistance in the C #/ Sql code required here.
>
>(I have a Save Transaction button on the screen which does all the saving to the main transaction file using an Sqladapter)
>
>Thanks in advance
>Regards,
>Gerard
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform