I'm trying to track down a SQL Server CE issue that means I cannot use SQL Server CE on a local hard drive of my computer. Clearly the error message is a bogus one as the filename is nowhere 开发者_如何学Cnear 260 chars
The file resolves to a path that is too long.
The maximum length is 260 characters. [ File name = D:\db.sdf ]
Specifically the D: drive. I have a very simple EF code first app that I want to unit test using SQL Server Compact Edition. When I run the app the first time I try to access the database I get the error above. Originally I tried using a simple filename as the Data Source in the connection string:
<add name="MyContext"
connectionString="Data Source=db.sdf"
providerName="System.Data.SqlServerCe.4.0" />
but got the error.
Then I tried specifying the root drive:
<add name="MyContext"
connectionString="Data Source=D:\db.sdf"
providerName="System.Data.SqlServerCe.4.0" />
and got the same error
If I tried using either a network drive or the c drive:
<add name="MyContext"
connectionString="Data Source=C:\db.sdf"
providerName="System.Data.SqlServerCe.4.0" />
or
<add name="MyContext"
connectionString="Data Source=\\Server\path\db.sdf"
providerName="System.Data.SqlServerCe.4.0" />
The it worked fine and the db was created and the operations performed.
I tried digging around in procmon and all I could find was an Explorer.exe process reporting invalid device for the d: drive.
Any help greatly appreciated
Cheers
Dave
Sounds a bit similar to my problem
I'm using MS Sql Server Management Studio Express R2 SP1...
When I try to create a CE/sdf database on the D:drive it just blinks at me, and asks me for the db path again
I managed to create a CE db on D: via Visual Studio (the inline server manager), but SSMSE still can't access it
If I do it on the C: it works fine.
Bizarre, but I think Sql CE just hates none C drives?
精彩评论