Why isn't this query working?
Posted on 2009-04-29
Hi I got this query from SQL mgmt. studio, but when I executed the code, myDB.bak was created, showing myDB.bak with 0KB, then it disappeared. Why my code is not working?
I am using MS Windows Server 2003
static void Main(string args)
string conStr = "server = localhost; database = myDB; user id = sa; password = ";
string query = @"BACKUP DATABASE [myDB] TO DISK = N'C:\myDB.bak' WITH NOFORMAT, INIT, NAME = N'myDB-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10";
SqlConnection conn = new SqlConnection(conStr);
SqlCommand comm = new SqlCommand(query, conn);
catch (Exception e)