Click here to Skip to main content
11,929,675 members (56,967 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# SQL Visual-Studio C#4.0 VS2010 , +
I have created a window application in c# 4.0, i used inbuilt sql database (.mdf datbase) in VS2010. earlier it was working fine. But now i noticed a problem in it.
1)user get added to the database, that is confirmed by ExecuteNoQuery return 1, as new one row is inserted.
2)Then next user is also added, as previous user id was 1, it check last id and increment id by 1. it also get successfully added.

3)Search operation also work properly.

But when i close the application, nothing get saved in database. I refresh database
after that also nothing happened.
So when i restart application, user id again start from 1.

When earlier add new database to project, only database with mdf and log file was created. But this time it also create DrishyaDatabaseDataSet.xsc files.(Once i deleted them , were they important)
Posted 29-Sep-12 11:00am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The xsc file does not contain information unless you are using the new data sources window to define default control binding for the data fields in your data set. That information will be used when you drag the data table to a WinForm to generate a default UI. If you are using this function, and change the binding controls in the data source window, the file will contain those settings. You would lose those settings, if you delete this file. However, if you don't use this, you don't need this file.

Your issue seems like
1. You may used uncommited transaction:
Commit any transactions before you close out.

2. Your DB is created every time:
Initial Catalog=Database1;Data Source=;Integrated Security=True;User Instance=False
footballpardeep 29-Sep-12 16:50pm
User Instance , should be true or false
Kuthuparakkal 29-Sep-12 16:55pm
footballpardeep 29-Sep-12 17:02pm
I tried but true/false but it's not working.
footballpardeep 29-Sep-12 17:05pm
How to comit any transaction.
footballpardeep 29-Sep-12 17:09pm

My project is here , can u check whether it is working fine there.
footballpardeep 29-Sep-12 17:10pm
thinks i have done in it is , add new user and search existing user by id,
footballpardeep 30-Sep-12 2:58am
Thanks for reply, there was problem in my connection string.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 30 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100