database won't be saved in the right directory
-
Saturday, August 04, 2012 12:56 AM
I have a database and It's been added in root directory of my application, when application has done editing the dataset, I call the method dataAdapter.Update();, these all got done by no error at all but the database won't save on it's directory, instead there is another database in root/bin/dubug folder that has my database and the changes on it... and every time I run the program it comes up with the original database contents with no changes at all!!
what should I do???
thanks in advance
P. khodaveissi
Here is a sample of my code:
This is the method I call for updating my database:
public void UpdateDatasource(GridControl grid, String tablename) { //Save the latest changes to the bound DataTable ColumnView View = (ColumnView)grid.FocusedView; if (!(View.PostEditor() && View.UpdateCurrentRow())) return; //Update the database's Suppliers table to which oleDBDataAdapter1 is connected DoUpdate(this.usertableTableAdapter.Adapter, this.library_dbDataSet.Tables[tablename]); } public void DoUpdate(SqlDataAdapter dataAdapter, System.Data.DataTable dataTable) { try { ColumnView view = userGridControl.FocusedView as ColumnView; view.CloseEditor(); if (view.UpdateCurrentRow()) { dataAdapter.AcceptChangesDuringUpdate = true; dataAdapter.Update(dataTable); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }- Moved by Janet YeildingMicrosoft Employee Tuesday, August 07, 2012 4:23 PM (From:SQL Server Data Tools)
- Moved by Bob BeaucheminMVP Wednesday, August 08, 2012 4:59 AM This sounds like a SQL Server Compact Edition database behavior, moving to the SQL Server Compact forum. If this is not a SQL Server Compact Edition database, you may want to repost it to the SQL Express or SSDT forum. (From:.NET Framework inside SQL Serve
All Replies
-
Sunday, August 05, 2012 8:36 AM
but the database won't save on it's directory, instead there is another database in root/bin/dubug folder that has my database and the changes on it... and every time I run the program it comes up with the original database contents with no changes at all!!
what should I do???
That's quite normal for debugging when you use a "user instance" of SQL Server. When you be your code, a copy of your database is created in the debug folder, where you work with. Imaging you have a bug in your code and it crashes / deletes the database, wouldn't it be better that happens to a copy rather then your origin database?
Instead of using "user instance" SQL Server you could attach your database to SQL Server to use it as a "normal" database.
Olaf Helper
* cogito ergo sum * errare humanum est * quote erat demonstrandum *
Wenn ich denke, ist das ein Fehler und das beweise ich täglich
Blog Xing- Marked As Answer by Iric WenModerator Sunday, August 12, 2012 8:57 AM

