Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Wednesday, March 21, 2012

Row lock versus Page lock in SQL 2000.

Hi
We are facing an acute situation in our web-application. Technology is ASP.NEt/VB.NET, SQL Server 2000.

Consider a scenario in which User 1 is clicking on a button which calls a SQL stored procedure. This procedure selects Group A of records of Database Page1.

At the same time if User 2 also clicks the same button which calls same SQL stored procedure. This procedure selects Group B of records of Database Page1.

So, its the same Page1 but different sets of records. At this moment, both the calls have shared locked on the Page1 inside the procedure.

Now, in call 1, inside the procedure after selecting Group A of records, the next statement is and update to those records. As soon as update statement executes, SQL Server throws a deadlock exception as follows :

Transaction (Process ID 78) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction

We are able to understand why its happening. Its because, Group A and Group B of records are on the same Page1. But both the users have shared lock on the Page1. So, no one gets the exclusive lock in records for update, even though, the records are different.

How can I resolve this issue? How can I get lock on wanted rows instead of entire page?

Please advice. Thanks a bunch.

PankajWhy are you implementing *read* locks? Concurrent access via pessimistic locking is very low. Try implementing optimistic locking.

If you absolutely cannot implement optimistic locking (think 3 times about this before deciding on pessimistic locking), then you can make it so user 2 doesn't get to see the records at all and instead gets a message saying try back later.sql

Wednesday, March 7, 2012

Rounding Modes and .NET Runtime Consistency

We have encountered something of a consistency issue in doing decimal type rounding between SQL Server 2005 and the .NET 2.0 runtime.

SQL Server seems to be using round to zero for Decimal and Money values. However, the .NET runtime, by default, uses round to even (also called 'Bankers Rounding'.) We are therefore stuck between a number of unpaletable options. We can:

Change every instance of rounding in our .NET codebase to use the overloaded rounding to force midpoint rounding.

Add a .NET extension to the database and call it in place of the built-in ROUND function.

Write our own banker's rounding function in T-SQL and call it.

Find a setting in either .NET or SQL Server to change the default rounding mode.

The first three all seem pretty nasty, though the middle two are probably the easiest within our (relatively speaking) C# heavy codebase. I seem to have pretty well eliminated finding a .NET setting (though I may have missed something.)

Is there an appropriate setting in SQL Server to do this? As yet I have not found one.

Andrew Raymond
Mitchell 1
Andrew.Raymond@.mitchell1.com

I don't believe there is any setting available to change the rounding scheme used in SQL Server, at least I can't remember ever having seen one...

/Kenneth

Rounding Error?

I'm passing a value from an ASP.net app to an sql stored procedure which stores it in a table.

Problem is if, for example, the value is 2.81 the value is ending up as 2.08999... in my table, but if i do say 6.3 it's fine.

Ive tried having the variable in asp and the field where its stored in sql as a number of types but all with the same result.

Any ideas?

Geoff.You should check the definition and precision of your database column.
Maybe change it from float to money.

Regards
Fredrik

Tuesday, February 21, 2012

rotate text to be up and down....?

I need to have text rotated 270 degrees from the standard starting position.
How do I rotate the text in the VS.Net 2003 environment?
Thanks,
KevinNot sure if this is what you are looking for, but change the WritingMode
property for the text box to tb-rl (Top to Bottom, Right to Left)
Hope that helps
-Steve
"Kevin" <Kevin@.discussions.microsoft.com> wrote in message
news:D5AEF903-9554-410D-9561-4EDA78576134@.microsoft.com...
> I need to have text rotated 270 degrees from the standard starting
position.
> How do I rotate the text in the VS.Net 2003 environment?
> Thanks,
> Kevin|||Thanks! That did it...
"Steven Bennett" wrote:
> Not sure if this is what you are looking for, but change the WritingMode
> property for the text box to tb-rl (Top to Bottom, Right to Left)
> Hope that helps
> -Steve
> "Kevin" <Kevin@.discussions.microsoft.com> wrote in message
> news:D5AEF903-9554-410D-9561-4EDA78576134@.microsoft.com...
> > I need to have text rotated 270 degrees from the standard starting
> position.
> > How do I rotate the text in the VS.Net 2003 environment?
> >
> > Thanks,
> >
> > Kevin
>
>|||hi,
how to show the text down to up in Vertical using tb-rl
thanks
robin.j
"Kevin" wrote:
> Thanks! That did it...
> "Steven Bennett" wrote:
> > Not sure if this is what you are looking for, but change the WritingMode
> > property for the text box to tb-rl (Top to Bottom, Right to Left)
> > Hope that helps
> >
> > -Steve
> > "Kevin" <Kevin@.discussions.microsoft.com> wrote in message
> > news:D5AEF903-9554-410D-9561-4EDA78576134@.microsoft.com...
> > > I need to have text rotated 270 degrees from the standard starting
> > position.
> > > How do I rotate the text in the VS.Net 2003 environment?
> > >
> > > Thanks,
> > >
> > > Kevin
> >
> >
> >|||Does anyone know how to rotate text, so as to create a bottom-to-top
direction (i.e. You'd turn your head to the left to read it correctly)
"tb-rl" gives top-to-bottom, but there isn't a "bt-rl" option :(
Thanks,
Mike.
--
Mike Stephen
"robin" wrote:
> hi,
> how to show the text down to up in Vertical using tb-rl
> thanks
> robin.j
> "Kevin" wrote:
> > Thanks! That did it...
> >
> > "Steven Bennett" wrote:
> >
> > > Not sure if this is what you are looking for, but change the WritingMode
> > > property for the text box to tb-rl (Top to Bottom, Right to Left)
> > > Hope that helps
> > >
> > > -Steve
> > > "Kevin" <Kevin@.discussions.microsoft.com> wrote in message
> > > news:D5AEF903-9554-410D-9561-4EDA78576134@.microsoft.com...
> > > > I need to have text rotated 270 degrees from the standard starting
> > > position.
> > > > How do I rotate the text in the VS.Net 2003 environment?
> > > >
> > > > Thanks,
> > > >
> > > > Kevin
> > >
> > >
> > >|||hi, you can write your own class which convert a string 2 an image, rotate the image , send it back to the report. use an image control to view your textimag
From http://www.developmentnow.com/g/115_2004_12_0_0_454324/rotate-text-to-be-up-and-down--.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com