JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Well,
this hasn't made any sense to me, but for some reason SqlBulkCopy keeps timing out when a tradition insert into statement run through a ExecuteNonQuery() works fine.
I've tried playing with the timeout wait on the sqlbulkcopy object but to no avail. Any suggestions for debugging this?
(this is the sql statement i'm running, and believe me when I say this is not the most complicated sql statement i've run through BulkCopy but for some reason it always times out on this one.)
The Insert statement that works:
as you can suspect, my SqlParser has these divided up so based upon a _bulk boolean flag it either uses the select statement with a SqlDataReader and the Destination table is the same as the insert statement. Turn the bulk flag off in my parser and it executes a NonQuery() as the insert statement. This is how I've done ALL of my sql in the application, and we're talking about...50 to 100 different statements generated real time with this parsing engine. Everything works, just for this one, the SqlBulkCopy times out and i have to use the NonQuery() method.
Thanks
this hasn't made any sense to me, but for some reason SqlBulkCopy keeps timing out when a tradition insert into statement run through a ExecuteNonQuery() works fine.
I've tried playing with the timeout wait on the sqlbulkcopy object but to no avail. Any suggestions for debugging this?
(this is the sql statement i'm running, and believe me when I say this is not the most complicated sql statement i've run through BulkCopy but for some reason it always times out on this one.)
VB.NET:
SELECT DISTINCT
[A].[Customer n°], [A].[Search name], [A].[Street], [A].[City],
[A].[State], [A].[ZIP-code], [A].[Phone], [A].[E-Mail],
[B].[ReturnCode]
FROM [xlImport1] AS [A],
[xlImport2] AS [B]
WHERE ([A].[Customer n°] = [B].[CORBI ID]) AND
([A].[Customer n°] NOT IN (
SELECT [lst_Customers].[Cust_Id]
FROM [lst_Customers]
)) AND
([B].[ReturnCode] IN (
SELECT [lst_CorbiLoc].[ID]
FROM [lst_CorbiLoc]
))
VB.NET:
INSERT INTO [lst_Customers]
([Cust_Id], [Name], [Addr1], [City], [State], [Zip], [Phone], [Email], [ReturnCode])
SELECT DISTINCT
[A].[Customer n°], [A].[Search name], [A].[Street], [A].[City],
[A].[State], [A].[ZIP-code], [A].[Phone], [A].[E-Mail],
[B].[ReturnCode]
FROM [xlImport1] AS [A],
[xlImport2] AS [B]
WHERE ([A].[Customer n°] = [B].[CORBI ID]) AND
([A].[Customer n°] NOT IN (
SELECT [lst_Customers].[Cust_Id]
FROM [lst_Customers]
)) AND
([B].[ReturnCode] IN (
SELECT [lst_CorbiLoc].[ID]
FROM [lst_CorbiLoc]
))
as you can suspect, my SqlParser has these divided up so based upon a _bulk boolean flag it either uses the select statement with a SqlDataReader and the Destination table is the same as the insert statement. Turn the bulk flag off in my parser and it executes a NonQuery() as the insert statement. This is how I've done ALL of my sql in the application, and we're talking about...50 to 100 different statements generated real time with this parsing engine. Everything works, just for this one, the SqlBulkCopy times out and i have to use the NonQuery() method.
Thanks