Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating Consecutive Numbers
Message
 
To
17/03/2010 15:59:14
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01455132
Message ID:
01455203
Views:
34
>>>>>>Hi,
>>>>>>
>>>>>>how do I generate consecutive numbers (for use as a customer number for example)? Is there anything in the framework that achieves this? I found reference to a function that autoincrements values, but it appears to b eonly on Primary Keys, this field is a candidate key.
>>>>>
>>>>>I used to have a foxpro method that did that. Oh wait, it was a Open Access method. That goes back a few years. It would be pretty easy to do it Frank if you wanted to I could dig up some old code. The one I did was used to create Permit numbers where I didn't want to skip any numbers like so many of them do if an order is canceled. I wrote my own that didn't skip. The complication on your situation is going to be since you also allow the user to enter what they want is you will have to generate your next valid number and also verify it doesn't already exist..
>>>>>
>>>>>I haven't heard back yet about if the framework has a way to hook into the autoincrement and at some point I will poke around to see if it is possible. I suspect it is a mechanism of the dataset stuff.
>>>>>
>>>>>Let me know if you want any of my old code that would help with making your own method.
>>>>>Tim
>>>>
>>>>What database are you using?
>>>>
>>>>SQL Server has the Identity type column - autoincrements w/o any client code.
>>>
>>>William,
>>>
>>>as I am the one with trouble, I guess you meant to ask me :)
>>>
>>>I am using SQL Server 2008 and have a thread here already on trying this with Identity fields. The problem is that I leave the field open for the user to enter a value, if they do not enter a value, then I want to generate the next consecutive value. I also encountered some issues with the Identity fields and the MM.NET framework which I was unable to understand.
>>
>>OK. Identity columns are really meant to be strictly database generated. There is an option (Set Identity_Insert ON) that will allow you to override that, but that will very likely lead to more trouble than it is worth.
>>
>
>I agree and have discarded the idea of using them for this purpose.
>
>>Are you always letting a user enter this field (and expecting it to be unique), or is that just for an administrative function in order to properly match a foreign key? If it is just for administrative use, then Set Identity_Insert on may be do-able.
>>
>
>The user can enter a value or leave it blank. If they leave it blank, when saving I want to generate the next consecutive number. If they enter a value I check for duplicates (and have a candidate key on this in the database).
>
>>I wouldn't know where to start in the MM.NET framework. I actually bought several licenses for it a couple of years ago for a project, but the MM framework simply was not compatible with that database structure so the licenses went in the drawer... :(
>
>That's interesting. How could the database structure not be compatible with a framework like this?

The database was built in a vertical structure. It had very simple main tables that held a single items of information that were related to other items and only meaningful if translated (translating value and datatype). Most of the guts of the database was in functions and stored procedures that related, assembled, and translated the data. MM.NET wasn't going to handle it and we were not interested in recreating in something MM.NET could use (standard relational database).

>
>So far I am finding that it makes certain things much easier, but other things aren't so easy (like grid views). It seems to me that the users of it also have bought other .NET controls (like Telerik) that make things even more easier.

You are dealing with 2 different animals - MM.NET is an actual framework that your application has to live with. Telerik makes controls that can go in most any asp.net application.

I've fought with several frameworks over the years, and I find I do much better w/o them. Of course, that can start a flame war very quickly :)
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform