SQL Server Large Database Backup Error

SQL Server Large Database Backup Error

I have a large MS SQL Server 2000 database which its size is about 300MB.
I have written a C# .NET 2005 code for creating a backup of it,  but I receive a "Timeout expired" exception.

I change the Connection Timeout property of the SqlConnection object, but I still receive the same error.

It takes a long time and Hard Disk activity , but no file is created.

But, when I use Microsoft Query Analyzer to execute the BACKUP DATABASE SQL Command, it works with no error(s).

aslan maloom nist che margeshe, Timeout am ke ziad mikoni baz engar na engar !

akhe masalan 3-4 minute am tool mikeshe, hard gher gher mikone, vali filesh create nemishe !

Any solution ?
Thank you,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The best way I would suggest is to create a job for the backup and run it at a schedule time. this works fine without any problems.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vitor MontalvãoMSSQL Senior EngineerCommented:
300MB it's a small database.
What's the connection timeout value? You can set it to 0 (zero) so you won't be disconnected by timeout.
You want to set the CommandTimeout, not the connection.
ConnectionTimeout is the to time to wait while trying to establish a connection.  You're not having trouble with that, you're problem is the command takes a long time to complete.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.