Click here to Skip to main content
15,914,111 members
Home / Discussions / C#
   

C#

 
AnswerRe: Web service calling business logic Pin
leppie21-Jul-08 14:49
leppie21-Jul-08 14:49 
GeneralRe: Web service calling business logic Pin
Gktony21-Jul-08 20:53
Gktony21-Jul-08 20:53 
QuestionImplementing IWebBrowser2 on WebBrowser control? Pin
Christopher Duncan21-Jul-08 6:16
Christopher Duncan21-Jul-08 6:16 
AnswerRe: Implementing IWebBrowser2 on WebBrowser control? Pin
led mike21-Jul-08 6:59
led mike21-Jul-08 6:59 
GeneralRe: Implementing IWebBrowser2 on WebBrowser control? Pin
Christopher Duncan21-Jul-08 7:12
Christopher Duncan21-Jul-08 7:12 
GeneralRe: Implementing IWebBrowser2 on WebBrowser control? Pin
led mike21-Jul-08 7:40
led mike21-Jul-08 7:40 
GeneralRe: Implementing IWebBrowser2 on WebBrowser control? Pin
Christopher Duncan21-Jul-08 8:24
Christopher Duncan21-Jul-08 8:24 
QuestionSystem.Net.Socket.Connected Pin
Jason McBurney21-Jul-08 5:58
Jason McBurney21-Jul-08 5:58 
AnswerRe: System.Net.Socket.Connected Pin
led mike21-Jul-08 7:16
led mike21-Jul-08 7:16 
GeneralRe: System.Net.Socket.Connected Pin
DaveyM6921-Jul-08 8:14
professionalDaveyM6921-Jul-08 8:14 
AnswerRe: System.Net.Socket.Connected Pin
nelsonpaixao21-Jul-08 13:10
nelsonpaixao21-Jul-08 13:10 
Questionstructured storage API Pin
Miss_hacker21-Jul-08 5:58
Miss_hacker21-Jul-08 5:58 
AnswerRe: structured storage API Pin
led mike21-Jul-08 6:57
led mike21-Jul-08 6:57 
GeneralRe: structured storage API Pin
Miss_hacker21-Jul-08 7:53
Miss_hacker21-Jul-08 7:53 
GeneralRe: structured storage API Pin
led mike21-Jul-08 7:59
led mike21-Jul-08 7:59 
GeneralRe: structured storage API Pin
DaveyM6921-Jul-08 8:21
professionalDaveyM6921-Jul-08 8:21 
GeneralRe: structured storage API Pin
Miss_hacker21-Jul-08 19:32
Miss_hacker21-Jul-08 19:32 
GeneralRe: structured storage API Pin
DaveyM6922-Jul-08 0:30
professionalDaveyM6922-Jul-08 0:30 
QuestionGenerating Incremental Values preceded with letters Pin
Banjo Ayorinde21-Jul-08 5:11
Banjo Ayorinde21-Jul-08 5:11 
AnswerRe: Generating Incremental Values preceded with letters Pin
Pete O'Hanlon21-Jul-08 5:41
mvePete O'Hanlon21-Jul-08 5:41 
Why is it that people keep coming up with requests like this? As a key, this isn't exactly the most efficient.

Anyway, to do this, create yourself a sequence table. This table will consist of the two colums, one for the code and the other for the next sequence number. Then, when you need the value update this table and set the sequence value = sequence value + 1 (use an appropriate locking strategy and run this inside a transaction). Next, read the value back again and subtract 1 to get the sequence you need and commit the transaction. This logic works because the update locks the row for the user who is attempting to get the value. If somebody else attempts to update the row when you are inside the transaction, they won't be able to - they have to wait until you have commited or rolled the transaction back. Note - the order you do this in is hugely important; you must do the update before the select for this to work.

It's a hack, but it's the cleanest way to do it. I've heard of people attempting to do this type of thing using MAX queries and the like, but these are prone to error.

Deja View - the feeling that you've seen this post before.

My blog | My articles



QuestionDate Range Function Pin
Reality Strikes21-Jul-08 4:04
Reality Strikes21-Jul-08 4:04 
AnswerRe: Date Range Function Pin
paas21-Jul-08 4:52
paas21-Jul-08 4:52 
GeneralRe: Date Range Function Pin
Reality Strikes21-Jul-08 8:18
Reality Strikes21-Jul-08 8:18 
AnswerRe: Date Range Function Pin
Luc Pattyn21-Jul-08 4:52
sitebuilderLuc Pattyn21-Jul-08 4:52 
GeneralRe: Date Range Function Pin
Reality Strikes21-Jul-08 8:19
Reality Strikes21-Jul-08 8:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.