Cannot Open my Database after changing its name and change back to its original name

Hi!

Please help!

I cannot open now my database after changing it name from the folder where it is save and also changed back to its original name.

Message recovery pending now is appearing as shown below:

Any chance that I could recover my database back?

I will appreciate any help from you Guys?

Thank you very much.!

Dennis

September 3rd, 2015 12:46pm

That means that recovery can not start. Did you change the name of the physical files for the database or log?

Have you checked the sql and system error logs?

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 1:14pm

Yes, you are exactly right.

I changed the name of the physical files for the database and log.

Now, i've done some procedures where I detached the database from the server and attach the corrected name physical database file but it fails showing this screenshot message

September 3rd, 2015 1:52pm

I restarted the windows and its all okey now..

Thank you for the help..

Now, I am on my original issue..

I was trying to connect my database to my C# visual studio using the data source add.. but this message keeps appearing that I have same name exist.. which I already fixed.. no other name exist other than this one..

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 2:02pm

Are you able to see the attached database properly in SSMS and access it? Because if not, try running SSMS in Admin mode before attempting to attach the database.
September 3rd, 2015 2:06pm

Yes, I can access the database from SSMS freely. I was able to attach it already after restarting my computer.

I supposed accessing through visual studio even running at administrator level wouldn't access it. That message tells me that I am assessing the same name exist which I am sure that there is no other same name exists.

I suspect that the file location is restricted. Isn't it?

I don't also about UNC share location?

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 2:21pm

Why your application needs to attach database at all then? What is said in your connection string? Why you can not use the database directly from the application?
September 3rd, 2015 2:24pm

I agree with Naomi.  If you are just creating a database connection in Visual Studio, you should not be attaching/detaching database files.  That is an administrator task.  Connections via Visual Studio are generally done through connection strings.

I would suggest that you take a step back and state the original intent of what you are attempting to do.  It may be better start from the beginning especially if it is a "can't connect to SQL Server" issue.

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 2:49pm

Hi Jimbo/Naomi,

I created my DB in SSMS and I want to access this in VS. The last screenshot above shows the error message whenever I want to access the DB from VS.

I dont have any issue now with the SSMS I can access it from there.

I hope this clarifies my case. Please if you have any idea of how should I be able to address the last screenshot message above.

September 3rd, 2015 5:53pm

As I said, something is wrong in your application. Can you post your connection string (don't post user and password)?
Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 10:37pm

Using a connection string to connect to a SQL Server database is generally a painless approach.  Below is a MSDN article detailing what needs to be done to connect to SQL Server via the Visual Studio wizard.

https://msdn.microsoft.com/en-us/library/w4dd7z6t.aspx

If you rather construct the connection string yourself, it should resemble the connection strings in the link below.

https://msdn.microsoft.com/en-us/library/jj653752%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

September 4th, 2015 9:56am

In future if you want to change the name of a database and the files use the detach/attach method instead (detach the database, rename/relocate the files and then attach the mdf specifying the new database name).
Free Windows Admin Tool Kit Click here and download it now
September 4th, 2015 10:08am

Using a connection string to connect to a SQL Server database is generally a painless approach.  Below is a MSDN article detailing what needs to be done to connect to SQL Server via the Visual Studio wizard.

https://msdn.microsoft.com/en-us/library/w4dd7z6t.aspx

If you rather construct the connection string yourself, it should resemble the connection strings in the link below.

https://msdn.microsoft.com/en-us/library/jj653752%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

  • Marked as answer by Cioden_sky 18 hours 48 minutes ago
September 4th, 2015 1:45pm

Hello Naomi,

Thank you so much for the help. I realized and figure out with your postings!

Thanks so much!

Dennis

  • Marked as answer by Cioden_sky 18 hours 47 minutes ago
Free Windows Admin Tool Kit Click here and download it now
September 6th, 2015 8:18am

Hello J I M B O,

Thank you so much for the help. I realized and figureD out by your postings!

Thanks so much!

Dennis

September 6th, 2015 8:19am

Yes Tony. You are exactly right. I realized those.

Thank you so much!

Cioden_sky

Free Windows Admin Tool Kit Click here and download it now
September 6th, 2015 8:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics