MS Access as a database for storing and retrieving data



Some clients prefer to use MS Access as a database for their software or web application. In this tutorial you will get a guide how to use MS Access as a database. To achieve this you should do following steps:

1.      Open MS Access. 



      2.      Create database by clicking on blank database.

      




3. Name your database on the area given.
4. Create your columns and save it.

5. Now, open your visual studio and make a new form to make software.

6. Make connection with access database as seen in image below. When you will click on add new database then a window will appear to give you comfort to add database as shown in image. This will give you connection string.
when you click on create new database then to add Ms Access as a database you will have to click on change button and will have to choose database as shown in image.


Now click on brows button to find you access sheet.



     7.      In the code behind instead of SqlClient , you will have to use OleDb as namespace and all command you will give through this name space. See the code.




    8.       OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\D Rock\Documents\Innovice.accdb");
In this code you should write your own connection path for making connection string. And rest of command will go like this
            con.Open();
            OleDbCommand cmd = new OleDbCommand(“write here your Sql Quaries”);
            cmd.ExecuteNonQuery();
 


   9.      In simple way I would like to say that use OleDb instead of Sql if you are using MS Access as a database.
 





 


















Comments

Popular posts from this blog

DTS package conversion in SSIS to use in SQL 2012 and SQL 2016

Infinite Scroll in Asp.Net C# using Javascript without Third party Plugin

Add Custom Tags in Web config file in ASP .Net