Solved

Using Local Database sdf in C#

Posted on 2008-06-19
3
7,582 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
  • 2
3 Comments
 
LVL 69

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 69

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

914 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now