I am facing a serious problem, with c# sqlTransaction,
The thing is, i have about 7 different tables that i execute a single transactions against(with a their autoIncrement IDs), which works fine for a single user when trying to insert new record... now the problem started when 10 users were capturing the information together and sometimes do concurent transections where the first user submits the form and the transaction starts(e.g at ID 1001), and user number 2 (few seconds after the 1st user) submits as well and get the second(1002) for the 1st and 2nd table, but for some reason(network signal maybe) 1st user insert is slow and and 2nd user's signal(speed) is faster and then the 2nd user ends up getting the 1st ID of the 3rd and the rest of the tables and the 1st user will get the second ID that was assigned to the 2nd user in the 1st 2 tables........
i think the problem here is the isolation mode which i didn't(or couldn't) set for the insert query to prevent the concurent insertion...
If i'm wrong please kindly correct me.
Now what i'm asking is you guys to help me control this...
The languages i'm using is/are..
1.c# in Visual studio 2010
2.Ms sql server 2008 r2
3. and asp.net...
I'd really appreciate ur help...
I'm sorry about the grama, English is not my home languege. thank you in advanve
thanx there man, the solution was to add and IsolationMode(Serializable)........
THANX once again, but u kinda ranked me too low with ur "if u thinking hiring a prof programmer wait till u hire an amatuer...".... i'm way better than an amatuer that this quiz may have reflected of me.... but i'll never stop learning
THANX once again, but u kinda ranked me too low with ur "if u thinking hiring a
prof programmer wait till u hire an amatuer...".... i'm way better than an
amatuer that this quiz may have reflected of me.... but i'll never stop learning
Er, that's just part of my sig. It was said by Red Adair[^] and is spot on but wasn't directed at you!
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum
Do you just need code to generate the strings in that sequence or do you need conversion to/from int?
The implementations likely will be quite different depending on the answer.
(Code based on the code you've posted assumes all you need is the strings in sequence. And never needing to start mid-sequence!)
It could be that is what Angela (OP) wants, however what is shown is that after Z9999 is AA000. I.e., as the length of the alpha part of the string gets longer, the numeric part gets shorter. The total string length remains 5.
Hi guys. StreamWriter.WriteAsync exists in 4.5 but not 4.0. I'm getting a sporadic error- out of memory exception, when I use StreamWriter.Write(String Builder). I'm not sure if I can move up to 4.5 yet, what's a good work around for 4.0?
How big is that freaking StringBuilder?? If you don't specify a size, it starts with 16 characters and allocates a new array internally every time you exceed it's capacity. So, it starts with 16, then goes to 32, 64, 128, 512, 1024, ... when you get into VERY large objects, you can be allocating megabytes of memory and possibly hit a size where the CLR doesn't have a big enough contiguous block of memory to fit the new size.
This also applies when you finally call .ToString on the StringBuilder. A new String object has to be allocated and the data in the StringBuilder copied to it. Again, if sufficiently big, the new String may not fit in memory because of a fragmented large object heap.
The CLR will allocate any object requiring more than 85K (IIRC) out of the LOB. The LOB isn't compacted and defragmented like the Smaller Object Heap is. So if you're allocating and freeing a bunch of large objects, you could be fragmenting the LOB to the point where you can't allocate a new object of the size you need, even though there's enough TOTAL free memory.
But, the way around this little problem using StringBuilder is to allocate the StringBuilder with a size sufficient to hold the entire POSSIBLE string without having it constantly reallocate itself.
Oh! And as for the StreamWriter.WriteAsync, there is no equivilent in any other version of .NET. You'd have to implement an Async version yourself. But, I don't think that has anything to do with your problem right now.