Link to home
Start Free TrialLog in
Avatar of marcgale
marcgale

asked on

SQLCommand.ExecuteNonQuery()

I'm inserting a large number of rows into a SQL 2000 database. The database lives on a different machine. SQLCommand.ExecuteNonQuery() fails, but pasting the exact text of the query into query analyzer and running it there succeeds. Why might this be the case?
Avatar of GoodJun
GoodJun

what error message you got?
I guess it may be due to a time out. You can try to increase the time out of the connection object (in connectionstring) and the sqlcommand object (a property) to see if it works.
what kind of sqlcommand are you using?
sql script ot stored procedure?
did you try a stored procedure?

greets, j.p.
Avatar of marcgale

ASKER

I have not adjusted the time out of the connectionstring - I'll try that. SQL not SProc.
What about the user.  Does the user that you use on the Query analyzer is the user user that you use on the conection string of the program.  If not try runing that sql on the query analyser with the same user as the program
ASKER CERTIFIED SOLUTION
Avatar of TRUENEUTRAL
TRUENEUTRAL

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
fails after a much shorter period of time than it takes for other queries to complete successfully. memory on the server side also does not appear to be an issue.
What is the error message?  what is the sql statement?
I would have sworn that I'd ruled out the timeout issue. It turns out that I did not. Thanks for the help and my apologies for the belated answer acceptance.