Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7733389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:58:33+00:00 2026-06-01T06:58:33+00:00

I am trying to create a backup of my SQL Server Database in Visual

  • 0

I am trying to create a backup of my SQL Server Database in Visual Studio 2010.

I am using the following command to back up the database:

BACKUP DATABASE Db TO DISK = ‘c:\server.bak’

This is connection string that I am using.

<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Db.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

However, when I run the command, I get the following error message.

Database ‘Db’ does not exist.

Here is a screenshot that describes my error:

http://www.cs.purdue.edu/homes/aerfanfa/sqlerror.jpg

Does anyone have a solution for my problem?
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:58:34+00:00Added an answer on June 1, 2026 at 6:58 am

    The problem is: your database db.mdf is not attached to the SQL Server Express instance – therefore, you cannot back it up.

    This whole AttachDbFileName=..... story is a bit tricky – and quite a mess, if you ask me.

    I would recommend to just forget about using that AttachDbFileName=... stuff, and instead:

    • just attach the db.mdf file to your local SQL Server Express instance (using SQL Server Management Studio Express)

    • talk to the attached database using it’s logical database name instead of messing around with a .mdf file

    Once you’ve done that – then you can use commands like BACKUP DATABASE ... and everything else!

    Your connection string would be much simpler, too!

    <add name="ConnectionString" 
         connectionString="Server=.\SQLEXPRESS;Database=YourDatabaseName;Integrated Security=True;"
         providerName="System.Data.SqlClient"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to create a backup for my SQL Server Database using SQL
I am trying to restore the database file(backup.sql) using c# by the following method...
I need to create a backup of a SQL Server 2005 Database that's only
I'm trying to restore a database (SQL SERVER 2008) from a backup in a
I am trying to create backup script for my ESXi server and I am
SQL Server 2000 on Windows Server 2003. I am trying to run a backup,
I am trying to create a backup of an android device using ADB. However
Running sql server 2005 I have database A. I am trying to restore from
I was trying to backup all my SQL Server databases and came across the
I'm using putty to connect to my MySQL server. I've a backup .sql file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.