Step By Step MsAccess DataBase Connection To Visual Studio 2012 Using OleDb Connection in C#.Net Window Application

MsAccess DataBase Connection To Visual Studio

MsAccess DataBase Connection To Visual Studio Using OleDb Connection in Window Application  Store Values To MsAccess DataBase in Particular Persional Computer(PC) C#.Net.

"MsAccess Close After Table & Field Created "

" If Open MsAccess Does Not Work In Visual Studio"



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;

namespace MsAccess_Creation
    public partial class Form1 : Form
        public Form1()

        private void button1_Click(object sender, EventArgs e)

            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Database3.accdb");

    OleDbCommand cmd = new OleDbCommand("insert into Register(name,mobile)values('"+txtName.Text+"','"+Convert.ToInt32(txtMobileNumber.Text)+"')",con);


            MessageBox.Show("Data Register");


First - Open - MsAccess Sheet

Next -Create New DataBase

Next - Create Table Fields & ID Automatic Generates

Next - Add New - Field - Select DataType = Text

Next - Change The Field Name = name

Next - Add New Field DataType=Number

Next - Click Save Button 

Next - Open - PopUp  Window - Change Table Name = Register - OK

If Want To Change The DataType  - Right Click Table Name- Go - To Design View 

Next - Change The DataType In Particular Fields

Next - Open The DataBase Source Folder - Copy To Change Another Colon(Drive)

Next - Change  To E Colon

Next - Server Explorer - Connect To Server 

Next - Select - Change Button 

Next - Change Data Source = Microsoft Access DataBase File.

Next - Select - Browse Button 

Next - Select DataBase  From E Drive - Open

Next - Get The DataBase From Drive Path 

Next - Click The Test Connection - Connection Succceded - OK

Next - Open DataBase From Server Explorer

Next - Select TextBox From  ToolBox - Change Id 

Next - Select TextBox From  ToolBox - Change Id 

Next - Go To - Data - Select  - OleDbConnection  

Next - OleDb Connection - Property - ConnectionString - DataBase Select 

Next - DataBase - Connection String Path Get 

Next - Add OleDb Connection Name Spaces - Insert Query Using OleDb Connection - Mobile Number Change To Integer Because DataType = Number

Next - Run[F5] - Enter Values To TextBox  - Register

Next - Data Register 

Next - Open Registered Data in Visual Studio

Next - Open MsAccess DataBase 

Next - Select - Table Name - Open

Next - Show Registered Data's From MsAccess DataBase


Post a Comment