- 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 25, 2024, 4:57 AM
Hi, I need for how to install local database in visual studio 2022.
Ramesh AnnaduraiPosted Nov 19, 2018, 6:19 AM
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, 7:05 PM
How many data can be stored in loacl database
PRINS TiwariPosted Sep 15, 2017, 2:48 AM
Nice Article.......
GokulPosted Jun 3, 2016, 4:40 AM
Nice..........
AKHILA VISHNU TSPosted Jan 26, 2016, 11:40 PM
Thanks
Dwi HyugaPosted Sep 27, 2015, 10:39 PM
where i can find the references?
AvosPosted Sep 24, 2015, 2:23 AM
is it possible if i change the database extention into .xml??
Arvind GuravPosted Jan 20, 2015, 3:16 AM
How to export and import the local database from wpf form using button
Udaya kumarPosted Oct 27, 2014, 9:07 AM
2)Any limitation compared to sqlserver database?
Udaya kumarPosted Oct 27, 2014, 9:06 AM
1)Is there is any difference bw local database and sqlserver database?
Janmejay YadavPosted Oct 15, 2014, 1:53 PM
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, 12:04 PM
Thank u Priti mam.This Article help me lot and I got useful Knowledge.Thank u Again
Priti KumariPosted Oct 14, 2014, 1:48 AM
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, 1:38 PM
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, 5:10 AM
thanks .......................
plazza selePosted Feb 18, 2014, 12:37 AM
Dear Author.. thanks for a nice article. but the DemoLocalDataBase.rar are not available. can you please re-upload them..