|
-
July 21st, 2009, 02:28 AM
#1
How to backing up dataBase using C# Code ?
Hi there, I have a database named : "ClinicDB.MDF"
I want to getting backup of this database with C# Code ...
i saw it's SQL Syntax,
here's an example of MSDN Library :
Code:
BACKUP DATABASE AdventureWorks
TO DISK = 'Z:\SQLServerBackups\AdvWorksData.bak'
WITH FORMAT;
GO
when I changed the dataBase name adventureWorks to ClinicDB and execute it, I got no answer ...
this is the SQL Server management studio Error :
Code:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.
Msg 319, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
and finally I want a code that can be run in C# and getting a backup dataBase operation, but I don't know how to code it ...
thanks if someone help ...
-
July 21st, 2009, 05:09 AM
#2
Re: How to backing up dataBase using C# Code ?
as the error message says it is expecting semicolon ; - before the
[CODE]WITH FORMAT[\CODE]
statement, try giving that
Last edited by vcdebugger; July 21st, 2009 at 05:12 AM.
-
July 21st, 2009, 06:50 AM
#3
Re: How to backing up dataBase using C# Code ?
Code:
BACKUP DATABASE [DataBaseName] TO DISK = 'C:\Program Files\...\db.bak' WITH INIT , NOUNLOAD , NAME = N'DataBaseName backup', NOSKIP , STATS = 10, NOFORMAT
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|