troubleshooting Question

C# framework 3.5 :SQL Server 2000: SqlBulkCopy:WriteToServer: What happening while another process is executing on database?

Avatar of nikavak
nikavakFlag for Greece asked on
Microsoft SQL Server.NET Programming
2 Comments1 Solution740 ViewsLast Modified:
I have an  sql server 2000 database.

I execute the following code:

SqlConnection conn_1 = null;

  conn_1 = new SqlConnection(_conn.ConnectionString);
                string str_ColumnTable;

                str_ColumnTable = string.Format("Columns_{0}", 1);
                if (conn_1.State == ConnectionState.Closed)

                using (SqlBulkCopy bcp = new SqlBulkCopy(conn_1))
                    bcp.DestinationTableName = str_ColumnTable;



I have also another application that deletes old records on the same database table on specific time.
I have the following question:
If the "delete"  application Starts, and on the same time the other application executes the specific code (...bcp.WriteToServer...), what happening?
By the way The delete operation has connection Time out 1800 seconds (on its connection string).
Yesterday I remark this:
First I delete records manually.
While deleting the records, the other program  executes  bcp.WriteToServer....
I have a record counter on interface of inserting program.I expect to put 500 records .
And the counter is stuck  in 8.I  was waiting for few seconds and then the application puts the rest 492 records.
I remark that on the same time the delete operation is complete.
So , if Delete operation is occur for example 20 minutes, can   bcp.WriteToServer --> wait for this time?
I read the opposite case:if    bcp.WriteToServer happens then no other operations happens concurrently.
But on specific case:  bcp.WriteToServer  puts  8 records -------wait deleting from another process--- complete  bcp.WriteToServer.
Could you please give some advices?

with regards ,
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros