- How to add Sdf file in application?
- How to create table in SDF Database?
- How to save Data in SDF database table?
Step 1: How to add Sdf file in application?
- Go to->Solution explorer->right click on your application->Add->New Item

- Go to->Data->Local dataBase->Click on Add button.

- Then go to->view menu->Server Explorer
Here you can see the local database which is created by you.
- Then Go To->Server Explorer->Expand your database(MyDB.sdf) ->right click on->table->Create Table.

- Write your table name and add column name and column data type, length etc. and click OK

In this Screen my table name and my column name.
Step 3: How to save Data in SDF database table?
I will use sqlserverce Name space.
Here I will insert , update, delete data from datatable which reflact in Actual Database table.
- If you want to insert,update,delete data from local database you need to add this namespace in your code System.Data.SqlServerCe
- Then write this method. In this method I have to use sqlceConnection, SqlCeCommand, SqlCeCommandBuilder.

- Then write Add method. In this method I have to write insert new record in local database table.

- Then Write Update method. In this method I have to write updation code.

- Then Write Delete method. In this method I have write delete code.

This is my complete demo. Please download attachment for complete Demo.


kamalesanPosted Jan 24, 2024, 11:57 PM EST
Hi, I need for how to install local database in visual studio 2022.
Ramesh AnnaduraiPosted Nov 19, 2018, 1:19 AM EST
Nice article. Need some clarifications - 1) Is this database is secured by default, if not how we can secure?. 2)Where the database file will be stored or is it running as database server locally?
tobby MarchalPosted Jul 29, 2018, 3:05 PM EDT
How many data can be stored in loacl database
PRINS TiwariPosted Sep 14, 2017, 10:48 PM EDT
Nice Article.......
GokulPosted Jun 3, 2016, 12:40 AM EDT
Nice..........
AKHILA VISHNU TSPosted Jan 26, 2016, 6:40 PM EST
Thanks
Dwi HyugaPosted Sep 27, 2015, 6:39 PM EDT
where i can find the references?
AvosPosted Sep 23, 2015, 10:23 PM EDT
is it possible if i change the database extention into .xml??
Arvind GuravPosted Jan 19, 2015, 10:16 PM EST
How to export and import the local database from wpf form using button
Udaya kumarPosted Oct 27, 2014, 5:07 AM EDT
2)Any limitation compared to sqlserver database?
Udaya kumarPosted Oct 27, 2014, 5:06 AM EDT
1)Is there is any difference bw local database and sqlserver database?
Janmejay YadavPosted Oct 15, 2014, 9:53 AM EDT
Mam I have also one problem when i saving data...data is saved sucessfull and also display in grid. But when i open show table data. then table is showing blank and there is no any data.
Janmejay YadavPosted Oct 15, 2014, 8:04 AM EDT
Thank u Priti mam.This Article help me lot and I got useful Knowledge.Thank u Again
Priti KumariPosted Oct 13, 2014, 9:48 PM EDT
Follow this link: http://www.c-sharpcorner.com/UploadFile/7d3362/curd-operation-in-local-database-sdf-file-in-window-appli/
Janmejay YadavPosted Oct 13, 2014, 9:38 AM EDT
Hello author this article is very useful .can you tell me how select particular name or age...means searching option in this....means i want to select particular name .....Eg. Select *from table-name where name=jay; how to perform this query here.
Patakaro ComPosted Oct 8, 2014, 1:10 AM EDT
thanks .......................
plazza selePosted Feb 17, 2014, 7:37 PM EST
Dear Author.. thanks for a nice article. but the DemoLocalDataBase.rar are not available. can you please re-upload them..