views:

32

answers:

1
  • A website to change add records delete etc

    • website is not connected architecture, so i cant expect sql to refuse writes to a table being edit by some one else also. As data is only written when its sent back to server by the grid..

so is there a way using c# and asp.net, some code , by which i cant explicitly tell the sql server to lock the table, so that viewing is allowed but writing to it gives error like

"sorry another user is using the writting function for this table please wait".

+1  A: 

No. SQL does not support "lock nowait" semantics with normal transaction modes; only Oracle does. See http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg08sql.htm#5732 for more information on Oracle. Yes, the code will just hang until the table is released.

There is an option of lowering your transaction mode, but then you get more like "free for all" semantics, which you probably also don't want.

Pieter