Sunday, July 12, 2009

Have do I save data in an Access database using Visual Studio 2005 Express, C# .NET?

I hope you are a C# .NET professional, because this is a nasty problem ;-)





I'd like to design an application that connects to an Access database.





Using Visual Studio 2005 Express Edition, I added the Access database to the Data Connections window (and the .mdb file is also shown in the solution explorer).





Next to that, I added a new DataSet related to the .mdf file.





Using this handy drag and drop technique I quickly added a DataGridView to my Designer surface.





If I run the program in Debug mode, add new records and hit the Save button, it seems to save the dataset back into the database (this idea is confirmed by the fact that the tableAdapter.Update() method returns a non-zero value).





However, if I rerun the program or look into my database using Access, nothing has changed.





Does anyone know what's going on?





Notice that I don't have this problem if I use an SQL database

Have do I save data in an Access database using Visual Studio 2005 Express, C# .NET?
Hi,





You might want to check that the Intenet Guest Account (IUSR_YOURCOMPNAME) has write access to the directory where your Access database is located. This account is used when connecting anonymously to IIS through a browser. :)
Reply:If I am not wrong, Access file is MDB, not MDF.





MDF is SQL Database file.





So I think you have the data update done into the SQL database rather than Access. (And you thinking is done on Access)


No comments:

Post a Comment