Solved

Using Local Database sdf in C#

Posted on 2008-06-19
3
7,609 Views
Last Modified: 2013-12-16
Hi Experts,

In my C# application I have created a database (Store.sdf) and then a Strongly Typed DataSet (Store.xsd). Everything is set up correctly and I can read information from the database, however when trying to insert data, using a number of methods. No data is ever inserted?

Any clues?
Insert Code
 
UsersAdapter.Insert(Username, Password)
 
// Nothing gets inserted?

Open in new window

0
Comment
Question by:wooderz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 21821216
Are you sure that nothing gets inserted or are you just looking at the wrong file?

Let me explain. Your Store.sdf file is surely at the root of your project. When you run the application, a copy of that file is copied to the bin folder and that's where the data is being updated. If you open the file at the root of your project to look at the data it contains, you won't see inserts/updates/deletes. Also, because you have opened the data file to view it, it will replace the copy in your bin folder because your root file is now "newer" then the bin file. You can change this last behavior by selecting the sdf file, going to its properties, and change the "copy to output directory" property to something else then "copy if newer".
0
 

Author Comment

by:wooderz
ID: 21821260
Yes you are right, this is what was happening. Bit rubbish if you ask me!
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 21821302
I agree. I discovered that behavior the hard way!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question