Solved

Using Local Database sdf in C#

Posted on 2008-06-19
3
7,580 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

12 Experts available now in Live!

Get 1:1 Help Now