Start New Discussion within our Software Development Community

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.

Comments
Thanks!
This article has been dead for over six months. Start a new discussion instead.