0

When the connection string is like

Data Source=IMMENSE-01\\SQLEXPRESS;Initial Catalog=dipar;Integrated Security=True

I can use this query to backup database

backup database dipar to disk ='F:\DBBackup\dipar.bak' with init,stats=10

But when I keep the database along with the program to make a executable file, the connection string is like

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\dipar.mdf;Integrated Security=True;User Instance=True

and the query to take backup backup database dipar to disk ='F:\DBBackup\dipar.bak' with init,stats=10 Says database not found.

Please help

1 Answer 1

1

Sorry, my first answer was incorrect.

If you're using the AttachDbFileName= approach in your connection string, you cannot use BACKUP DATABASE since that database file is not really attached to the SQL Server Express instance. That's one of the many drawbacks and shortcomings of that approach – marc_s

From: How to create database backup, when DB not stored in Microsoft SQL Server?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.