Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL C#4.0 VS2010 database
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.
working:
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.
1
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 10:00am

1 solution

Rate this: bad
good
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.
 
or
2. Your DB is created every time:
Initial Catalog=Database1;Data Source=;Integrated Security=True;User Instance=False
  Permalink  
Comments
footballpardeep at 29-Sep-12 16:50pm
   
User Instance , should be true or false
Kuthuparakkal at 29-Sep-12 16:55pm
   
false
footballpardeep at 29-Sep-12 17:02pm
   
I tried but true/false but it's not working.
footballpardeep at 29-Sep-12 17:05pm
   
How to comit any transaction.
footballpardeep at 29-Sep-12 17:09pm
   
http://www.4shared.com/archive/tpmIdiUI/Drishya.html
 
My project is here , can u check whether it is working fine there.
footballpardeep at 29-Sep-12 17:10pm
   
thinks i have done in it is , add new user and search existing user by id,
footballpardeep at 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
0 OriginalGriff 375
1 Sergey Alexandrovich Kryukov 183
2 Prakriti Goyal 177
3 jlopez788 134
4 Kruti Joshi 117
0 OriginalGriff 6,742
1 Sergey Alexandrovich Kryukov 5,479
2 Maciej Los 3,474
3 Peter Leow 3,313
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 30 Sep 2012
Copyright © CodeProject, 1999-2014
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