Posts

Showing posts with the label C#

OLEDB Database connection string in C#.Net

OledDb database connections allow C# developers to build data powered applications with Access database. It can be possible with Database connection object and command object. Connection string  For connecting .mdb Access files you can use the following connection string, string connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:/.Net Project/PharmaERP/PharmaERP/PharmaData.mdb"; and for the Access 2007, 2012,2016 databases you have to use the following one. string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;;Data Source=D:/.Net Project/PharmaERP/pharmaData.accdb;Jet OLEDB:Database Password=password";  Now we are ready to setup the connection, let build the connection objects and get started. Connecting database with OleDbConnection object.     OleDbConnection conn; OleDbCommand Rs; public void Connect() { conn = new OleDbConnection(connstr); conn.Open(); } With the OleDbConnection o...