Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Access
I created an access database and now I want to add some data into it using C# but when I close my app,my data gone!
Now How can I stanch my data into database using C#!!!
for example I have some name like: Name:
now I want add the name "Amir" into name in database and I want to look it into my field...
help me!
Posted 18-Sep-12 4:21am
Edited 18-Sep-12 5:17am
Kschuler at 18-Sep-12 10:33am
Post the code you are using to add the data and we can help you find any problems in the code. Also, what kind of project is this for? Website, Windows Forms, etc? How do you connect to the database?
amir.nazarizadeh at 18-Sep-12 10:55am
excuse me!
it's windows form and I want code for add my new data into database!
Killzone DeathMan at 18-Sep-12 10:35am
One day I have the same problem...
Right click on the database -> Properties and there is about three options like:
"Copy Always"
"Copy if newer"
"Not Copy"
Something like that, and you put: "Copy if newer"!
Kschuler at 18-Sep-12 10:52am
You should post this as a possible solution, instead of just a comment.
Killzone DeathMan at 18-Sep-12 16:56pm
I dont care about the reputation points in this site, I only care about programming experience...
Have a nice day!
Kschuler at 18-Sep-12 17:02pm
I was more concerned about others who may search through these question/answers with similar problems. But whatever. Looks like the OP found something that worked. :)
amir.nazarizadeh at 19-Sep-12 0:06am
your answer is the best Killzone!
thanks and thanks.
have a nice day.
amir.nazarizadeh at 18-Sep-12 10:58am
thanks a lot Killzone.
that was nice but I want to copy my new data into database's field...
for example I have some name like:
now I want add the name "Amir" into name in database and I want to look it into my field...
Killzone DeathMan at 18-Sep-12 16:57pm
You are welcome! :)
I you want something, let me know!
sjelen at 18-Sep-12 10:49am
Make sure the database isn't open in Access when your application is running.
It will lock the file and prevent writing data from your app.
Wes Aday at 18-Sep-12 11:23am
If your data is coming up missing then either you are not writing it to begin with or you are copying over your database. And I do not see what the problem is with writing a name to your database. What exactly is the issue?
amir.nazarizadeh at 18-Sep-12 11:29am
think you have some name default
now you want to add a new name into the field,
it creates but it doesn't show into the database
Wes Aday at 18-Sep-12 11:38am
"it creates but it doesn't show into the database" and that means what exactly? Is it writing to the database or not?

1 solution

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

Solution 1

Where do you have your database: in the project folder?
If yes, move your database in to another folder.
BTW: Name is a reserved word in MS Access. Never use it as the name of column.
More about reserved words at:[^][^]
Sandeep Mewara at 18-Sep-12 12:09pm
Yep. My 5!
losmac at 18-Sep-12 12:12pm
Thank you, Sandeep ;)
amir.nazarizadeh at 18-Sep-12 13:41pm
no no,,,"name" is an example,I didn't use it!

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

  Print Answers RSS
0 CPallini 395
1 Sergey Alexandrovich Kryukov 333
2 BillWoodruff 309
3 OriginalGriff 307
4 George Jonsson 275
0 OriginalGriff 5,095
1 CPallini 4,285
2 Sergey Alexandrovich Kryukov 3,767
3 George Jonsson 2,941
4 Gihan Liyanage 2,386

Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 18 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