I have a SQL datafile that I (for some unknown reason) put on OneDrive. Now it works fine for most of the applications in my program, but I can not access the database through SSMS. I have a SSMS query that backs up the database and I can't get to it. I tried moving the database to a different drive, but I get the dreaded "You are not the owner of this file." error.
Confused! What exactly is on OneDrive?
a. The backup (.bak) file?
b. The database files (.mdf, .ndf, .log)?
When you say,
I have a SSMS query that backs up the database and I can't get to it
Do you mean you can't get to the query, the backup or the database?
The database file is on OneDrive, (DVD_List.mdf), The database shows up in File Manager, but SSMS can't find it. The query will run, but doesn't back up the database, basically because SSMS says it doesn't exist. My program can open the datafile, and correctly manipulates the data so why doesn't SSMS see it? I have tried to attach the file to SSMS but as I say It can't find it.
what tool did you use to put the db on OneDrive. That is, if you used SSMS to create it there, you should be able to access it the same way. But you can't. So I'd like to know how you created it.
To be honest I'm not sure how I got it there, I think I restored it there from a back-up file that no longer exists. It was on the drive that went bad. In looking through my directories it looks like this is the only existing copy of the file.
In the meantime,I created a new database with the intentions to (if necessary) re-enter the data into it. Once I created the database and the accompanying table I tried to attach it to my VB program and got the message 'This file is in use'. I went back into MSSQLS opened the file, took it off line and brought it back online, closed everything out and went back into VS. Opened the new app file, attempted to attach the database and got the same results. I even shut down the computer and restarted it, loaded VS, reloaded the app, and attempted to attach the file getting the same results.
I know I'm 72 years old, and nowhere as good as I used to be, but this simple stuff should still be second nature to me, What the heck am I doing wrong?
In your VB program are you using SqlClient to access the database? If not, can you you post the section of code that tries to access the database?
Where is the error message issued, exactly?