开发者

save new data to root/bin/debug/database1.mdf

us开发者_如何学运维e:c# 2008 exprees edition

DB:sql server express

when in application add database1.mdf this file copy to root application.

when insert valuse(.....) data insert to root/bin/debug/database1.mdf

and database1.mdf in root application does not change.

we how can view new data in database1.mdf


If the data in your database1.mdf isnt changing, then your app has opened another copy somewhere. Check which file is actually changed.


You can view the data by examining the database in "root/bin/debug/database1.mdf". Either create a second Data Connection in Server Explorer that points to the "root/bin/debug/database1.mdf" or use SSMS/SQL to attach the database to a given database server.

The likelihood is that the database you can see in your solution explorer has a "Build Output" (see the properties for the database1.mdf file) to Copy Always or similar.

When you debug your project, Visual Studio (and co) compile your project to the designated output folder (root/bin/debug). This copies the database you can see in your Solution Explorer to the output directory, overwriting any previous database that may have been there.

If you want to examine the database during/post-debug, do the above and navigate to the .mdf file in the bin folder. Just bear in mind that any changes you make there will be overwritten next time you debug due to aforementioned process


SQL Server Express is a DataBase Server, and the mdf file is located on the directory the server works in its own directory, not in the app directory.

Please correct me if I'm wrong! :) thanks.

EDIT: If you want to work with files as I think you want, you may use SQL Compact Edition, more than SQL Server Express Edition.

I've seen this on msdn social http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/e24a766f-a507-4755-9ceb-1ec0fbe70ed5/

See you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜