Check SQL Server CE database after INSERTION to evaluate application

I have the following script to insert into a SQL Server CE database

SqlCeConnection Con = new SqlCeConnection();
Con.ConnectionString = (@"Data Source=|DataDirectory|\Database.sdf;Password=Password;");
Con.Open();
SqlCeCommand Query = new SqlCeCommand("INSERT INTO Users(ID,Name,FName,Address,MCode,MNum,Amount) VALUES(@ID,@Name,@FName,@Address,@Code,@Num,@Amount)", Con)
Query.Parameters.AddWithValue("@ID", ID + 1);
Query.Parameters.AddWithValue("@Name", NBox.Text);
Query.Parameters.AddWithValue("@FName", SOBox.Text);
Query.Parameters.AddWithValue("@Address", AdBox.Text);
Query.Parameters.AddWithValue("@Code", Convert.ToInt32(MCode.Text));
Query.Parameters.AddWithValue("@Num", Convert.ToInt32(MNum.Text));
Query.Parameters.AddWithValue("@Amount", Convert.ToInt32(AmBox.Text));

int rowsEffected=Query.ExecuteNonQuery();

MessageBox.Show(rowsEffected.ToString());

After entering the show message box, rows affected=1this means that the data successfully inserted into the database, I use VC # 2010 as a file copy property, moves the database file to folders Debug/Bin/Release, and when I check my database file in my project folder, it’s empty. since the file is Bin/Releasedisplayed outside of Solution Explorer, so I cannot check it. I want to check my DB file for evaluation, i.e. data is inserted correctly in it or not.

Tell me how to do it

Thank!

0
source share
1 answer

Here is your problem:

... copy DB Debug/Bin/Release ,

- , . Visual Studio ( ) (Bin/Release - ). , .

" DB ", , , . , , , DataDirectory, , (Bin/release ).

... Bin/Release ...

, . , Stream.Write Console.Writeline. , , .cs . . Bin/Release - .

+2

All Articles