I have a Windows desktop application that uses a SQLServer Express database. The database files are downloaded from my website, followed by the application download (written in VBE). The first procedure is to attach the database to the SQLServer
instance from within the application. I have two test machines one runs Windows XP x84, the other Windows 7 x64. I never have issues on attaching the database files in my test envirnoment but twice now other people downloading have got the
System.Data.Sqlclient.sqlexception (ox 80131904) Directory lookup for the file C:\Documtents and Settings\Administrator\Desktop\Tem1.mdf failed with the operating system error 5 (failed to retrieve text for this error. Reason 1815) changed database context
I'm not sure what the problem is and therefore how to correct the issue. I attach the database in code using the create statement e.g.
cmd7.CommandText = "USE Master CREATE DATABASE Tem1 ON PRIMARY (FILENAME = '" & DBFullPath & "') LOG ON (FILENAME = '" & DbLogPath & "') FOR ATTACH"
Any help or suggestions would be very much appreciated.
View Complete Post