navigation

Make Database connection through OleDb in C#

Guys there is very simple view to make database connection :
There are
1). First import following
using System.Data.OleDb;
at the top of your project.

2). Then come into your class of form :
and define two object one for connection, second for command

     public partial class Form1 : Form
    {
        private OleDbConnection Conn = new OleDbConnection();
        private OleDbCommand cmd  = new OleDbCommand();
3). come into the constructor of your class and give connection string to your connection Obj
               
     public Form1()
        {
            InitializeComponent();
             try
            {
                Conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=final_app.accdb;Persist Security Info=True";
                Conn.Open();
             
            }
4). Your have done !!

Other related Topics :
How to Add MS-ACCESS Database ??
How to get connection string ??



Make Database connection through OleDb in C# Make Database connection through OleDb in C# Reviewed by Unknown on 07:18 Rating: 5

No comments:

Powered by Blogger.