Vous êtes sur la page 1sur 1

Adding Record on a Database

First, we need to put the libraries where OleDBConnection, OleDBDataAdapter and DataTable is located.

using System.Data;
using System.Data.OleDb;

then, we will create an object for OleDBConnection, OleDBDataAdapter and DataTable


OleDbConnection con = new OleDbConnection();
OleDbDataAdapter dba = new OleDbDataAdapter();
DataTable dtable = new DataTable();

In the form load, we will declare the connection string for our database
private void Form3_Load(object sender, EventArgs e)
{
string cons="Provider=Microsoft.Jet.Oledb.4.0;Data Source= SPDB.mdb";
con.ConnectionString = cons;

Vous aimerez peut-être aussi