|
Seconding what Colin said, if you go with doing an identity field, you will not have to be concerned about it.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
That would be a reason not to use integers for primary keys.
|
|
|
|
|
What is the alternative? GUIDs?
|
|
|
|
|
Yes, they solve this kind of problem and others (at the cost of space, sure, but we have plenty of that now ).
But you also say you can't change the table so that's not an option here.
After I hit send on the other post I remembered that back when I used Oracle (6) there were "sequences" or something that gave the "next integer" and when the company I worked at the time started using SQL Server (6) we no longer had those and apparently not "identities" either, so we cobbled up our own "sequences" -- a table that held the necessary information to get the "next integer" for a particular table.
That may be an ancient technique to resurrect in your case.
|
|
|
|
|
Chain the GetMaxValue and the Insert in the same transaction.
Do housekeeping on the transaction log, though.
|
|
|
|
|
Normally, when you want to do this type of thing you need to create your own Sequence table, which contains the Next ID that you want to use. Then inside a transaction, you update the row to add 1 to it, and retrieve it, before committing it. You must do this in that order, so that no other user can get access to the record while you are working with it.
|
|
|
|
|
How do I do this? An example of what I'm trying to do is in MSN Messenger, when someone sends you a message and the window name flashes on your start menu bar.
Thanks.
|
|
|
|
|
You can do this using the FlashWindow() /FlashWindowEx() function. Take a look at this article.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
Thanks .
|
|
|
|
|
hi friends ,
I am sathish kumar ,I am developing a three tier windows application using .net framework 3.5 and sql server 2005 , I want to know how to deploy my application using windows installer , i scripted my database i want to run the script along with my installer during installation it must ask the user to choose the database instance and that must be reflected to app.config file so that my application might run in my client machine.
pls tell me help me or tell me any other better idea to deploy my application pls help me friends i am waiting for ur fav reply
pls provide me some videos and steps for deployment
|
|
|
|
|
|
Hi All,
I have a little application and a part of it has to send e-mails. Bud the problem is that when i click on send email button and the application tries to send the e-mail, my form freezes til the e-mail is out and i can't do anything else on the form.
What can i do to provide that?
Thanx.
|
|
|
|
|
NewToAspDotNet wrote: have a little application and a part of it has to send e-mails. Bud the problem is that when i click on send email button and the application tries to send the e-mail, my form freezes til the e-mail is out and i can't do anything else on the form.
Use a background thread instead to send the mail
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
|
Hi everybody,
i'm creating an application using an external liberay that creates a control.If you click on this control it reacts on the mouse click, but i want to cancel this. I want to implement my own mouse click event for that control and cancel the click message to the control. Problem is that the control receives the mouse click event as first.
I tries to use wndproc to implement my own code but still the control receive the click first.
Can this be done by using a hook?
How do i implement this and then cancel the mouse event before it reaches the control??
Thnx
|
|
|
|
|
Can you derive your control from it?
|
|
|
|
|
you can use cancel propert of the e arg that is passed to the event handler like this:
e.Cancel = true;
Touraj Ebrahimi [toraj_e] [at] [yahoo] [dot] [com]
|
|
|
|
|
No I can not use any properties of the control...
I have to receive the cliock message before it reaches the control and cancel it!
Anybody an Idea?
|
|
|
|
|
Can any one help
How to Drag and Drop the Button Control using Windows Presentation Foundation(C Sharp)
|
|
|
|
|
bruze wrote: How to Drag and Drop the Button Control using WPF
Better ask in the WPF Forum
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi there...
I´m facing a strange problem... I made a WebApp which serializate a complex object and save in the bank and load to save time of processor. When the WebApp save and read the object everything goes fine, but If I install one second WebApp in other server the same object is readed but the HashCode is differently from the original...
Anyone has a opnion about that??
Thanks in advance...
|
|
|
|
|
This is strange.
You should try to compare and see if they are the same (time stamps and everything)
If you can not find anything override the default Objectt.GetHashcode function and write your own. If you have an id for the object just use return id.GetHashCode(); in the override.
Natza Mitzi
|
|
|
|
|
Natza Mitzi wrote: This is strange.
It is not strange, it's perfect normal behaviour. I suggest you read about the topic a bit more. It has 'bitten' me a few times
|
|
|
|
|
You are correct.
Natza Mitzi
|
|
|
|
|
I suppose this is normal behaviour. There are no guarantees that the hash code is the same when retrieved for an object nor that it is unique. If you want to predict the value of the hashcode (for example that it stays the same), you must build your own implementation.
From BOL:
The default implementation of the GetHashCode method does not guarantee unique return values for different objects. Furthermore, the .NET Framework does not guarantee the default implementation of the GetHashCode method, and the value it returns will be the same between different versions of the .NET Framework. Consequently, the default implementation of this method must not be used as a unique object identifier for hashing purposes.
|
|
|
|