ado.net & access

  • Thread starter Thread starter Martin
  • Start date Start date
Yes, check out www.connectionstrings.com for the connectionstring...

a.. Standard security:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User
Id=admin;Password=;"


b.. Workgroup (system database):
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet
OLEDB:System Database=system.mdw;","admin", ""


c.. With password:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet
OLEDB:Database Password=MyDbPassword;","admin", ""


But basically it's like this

OledbConnection cn = new OledbConnection(yourConnectString)

//Depends on if you are using connected or disconnected methodology, but
either way, create a command object, associate a connection with it, and
fire it against the DataAdapter or DataReader

OledbCommand cmd = new OledBCommand("SELECT * FROM someTable", cn)

If you check google, there are literally thousands of examples, and using a
DataReader vs. DataSet vs. COmmandOBject is beyond the scope of a simple
post...but either way you only need about three mroe lines to get any of the
approaches to work.
HTH,

Bill
 
Back
Top