When I use the insert function I can see new data at the front end. But I cannot see the new data in Access. Other times when I close the application and restart, new recorded is not there. If I look in Access application and closed it then open VS2010 application new data is not there. What is going on?

this is my code:

usersTableAdapter1.InsertUser(UserNameTextBox.Text.Trim(), PasswordTextBox.Text.Trim());

userTableAdapter is a tabel adapter insid DataSet.xsd i created insid my windows Application
have this query "InsertUser" with tow paramter

then I try another code but does not work :

                                        OleDbCommand oleDbCMD = new OleDbCommand();
                                        oleDbCMD.CommandText = "INSERT INTO Users([UserName],[Password]) VALUES (@UserName,@Password)";

                                        oleDbCMD.Connection = conn;
                                        oleDbCMD.CommandType = CommandType.Text;

                                        oleDbCMD.Parameters.AddWithValue("@UserName", UserNameTextBox.Text.Trim());
                                        oleDbCMD.Parameters.AddWithValue("@Password", PasswordTextBox.Text.Trim());

                                        OleDbDataAdapter dAdapter = new OleDbDataAdapter();
                                        dAdapter.InsertCommand = oleDbCMD;

                                        oleDbCMD.ExecuteReader();

If you are running in debug mode, Visual Studio makes a copy of the database for you to 'experiment' on, so you don't lose your original database.

commented: Thanks! +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.