Check SQL Server CE database after INSERTION for application evaluation

后端 未结 1 1267
说谎
说谎 2020-12-22 08:15

I have the following script for insertion into a SQL Server CE database

SqlCeConnection Con = new SqlCeConnection();
Con.ConnectionString = (@\"Data Source=|         


        
相关标签:
1条回答
  • 2020-12-22 08:40

    Here's your problem:

    ... file copy property moves DB file to Debug/Bin/Release Folder and when i check my database file in my project folder it is empty

    The database file in your project folder is the original, unchanged source data. When you build your app Visual Studio copies (not moves) the original project file to your output folder (Bin/Release or whatever). Your code inserts the data into the copy, not the original unchanged data.

    To "check your DB file for evaluation" you have to check the copy, not the original, unchanged, source file. You can do that either from the same app that inserts the data, from a test app that also uses the DataDirectory property if it is in the same output folder, or you can open the file in the output directory (Bin/release in your case).

    ... Bin/Release file is visible outside the Solution explorer ...

    Yes, because it is not part of your project. It is output data as if you called Stream.Write or Console.Writeline. The original, unchanged source data is part of your source, like your .cs files. It is not delivered to the user or changed by running your app. You have to test the copy in Bin/Release or whatever.

    0 讨论(0)
提交回复
热议问题