View Complete Post
In my procedure, I need first to run a merge table T using table S and then truncate table S. And other session might insert data into the table S during my execution of the procedure. So I'd like to lock the table in exclusive mode for the whole
transaction, but how to do that?
If I only lock the table during the merge phase, if after merge completed but before truncate begin, another session inserted some data into it, then the data in S will be missing when run the procedure again.
merge T using S .....
truncate table S;
I created a transactionscope over 2 code activities,
Code activity1 opens a connection, fires an insert into a table and closes the connection.
Code actibity2 also opens connection, does a simple insert into same table and closes the connection
I get the following exception:
The 1st code activity runs fine, then the second code activity fails when it tries to open a connection and I get this message "Communication with the underlying transaction manager has failed.
I have persistence services working properly, I'm able to persist the workflows..which means my MSDTC is configured right, also able to insert data into the tables..but when I use the transactionscope I just get that error whever I open the connection in the
second code activity
Am I missing something or this is one of those inbuilt bugs of the "workflowfoundation" bugs like the timer etc?
I have a deadlock problem that occurs every 5 minutes on SQL update. I get the following error randomly - means qurey failed one time every 200 calls. I'm using transaction scope to manage transaction.
using(TransactionScope scope = new TransactionScope())
SELECT ... FROM TABLE1
UPDATE TABLE1 SET [F1] = @F1, [F2] = @F2, [F3] = @F3, [F4] = @F4, [F5] = @F5 WHERE UId = @UId
System.Data.SqlClient.SqlException: Transaction (Process ID 51) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction
I am getting this error continously please help me out
Transaction (Process ID 106) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
Hi! I'm creating an application that's supposed to first add a record to table1, and then get the ID from that record to use when adding a record to table2, to be able to associate these two records with eachother.
The user gets to type in some values that goes to table1, and some values that goes to table2, but before the insert statement for table2 is executed i need the ID from the recently added record in table1. Some dude told me to use a trigger for the autopopulate purpose, but does that really work when i also need to save some values that's user input, and when those values doesn't get saved in table1?
Are there any other way to do this or can i send values to a trigger? I'm new to triggers and stored procedures, i don't have any particular knowledge of this, any help is appreciated!
i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset
like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid as a compact data and combination of 3 tables from d single dataset.....
can some1 help me please.....
I have two tables
Trans with fields TransID, Date, CustomerID and some other stuff
Customer with fields CustomerID, Name, TaxId
On the screen the user only sees the fields Date and Customer Name. CustomerID is behind the scenes only.
I'm using SqlDataSource. Having no problems with SelectCommand. I don't know how to construct the UpdateCommand and InsertCommand.
Let's say the user changes the date, then I need to do an UPDATE.
UPDATE Trans SET Date = @Date, CustomerID = @CustomerID results in an error message and the record is not updated.
I get an error on the page that says "Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in correct format".
I tried taking out the set for CustomerID and I still get the error on page.
Also, for inserting, the users will see a dropdownlist with Customer Names. I need to convert that to a CustomerID to be used in the new record being inserted in the database. I'm not sure how to do this.
Do I need to do something with Control Parameters?
Sorry I am kinda new in web services, so it may sound a bit newbish question.
We have a web service that comunicates with the database and exposes web methods that enables the application to access the database. Each method does only one operation (Insert, Update or Delete). What I need to do is create a transaction that will be consisted of multiple calls to the database, meaning multiple calls of more then one web methods. Can I do that? (I read that if the web method does not throw exception - or ContextUtil.SetAbort() is not called - the transaction will be commited automatically when the web method finishes executing, which I don't want to happen because I want to call another web method in the same transaction, and then manually commit the transaction)
Thank you in advance.
Hi! I want to display a crystal report in my vb.net application. Suppose I have tables named student details, student
marks, student address, etc... Now
if I want to display all these details (fields of all tables)
in one crystal report (with page breaks if necessary) then how will I
achieve it. I will be providing a combo box in my application that contains list of student names.
How can I link this combo box with the cystal report to
dynamically display report for different student on selected index
change of combo box? Help me friends. An example would be appreciable.
MSDN Magazine May 2007
MSDN Magazine November 2006
In my last column, I showed the various thread synchronization mechanisms employed by the MicrosoftÃÂ® . NET Framework (see Concurrent Affairs: Performance-Conscious Thread Synchronization). I then examined the performance characteristics of all these mechanisms and determined that the Interlocked methods performed the best because the calling thread never has to transition to kernel mode.
MSDN Magazine March 2006