How to get oledb connection?

Answer Posted / senthil kumar

using OLEDB connection we can connect the MS-ACCESS,Sql
Server,Oracle.

here i given the coding for connect the oledb connection

OleDbConnection con = new OleDbConnection();
con.ConnectionString="Provider=Microsoft.Jet.OleDb.4.0;Data
Source=databasenamewithpath;";
con.Open();

then u can use the dataset or datareader
OleDbCommand cmd = new OleDbCommand(sql,con);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();


OleDbDataReader reader;
reader = cmd.ExecuteReader();


OleDbDataAdapter oda = new OleDbDataAdapter(sql,con);
DataSet ds = new DataSet();
oda.Fill(ds,"tablename");

i hope that these are enough.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is ado.net dead?

530


What is the use of adodc?

524


How can I retrieve two tables of data at a time by using data reader? Data reader read and forward only, how is it possible to get 2 tables of data at a time?

520


Does executenonquery return a value?

538


What is XML serialization

587






Describe briefly an ADO.NET Dataset ?

549


Compare Data Reader & Dataset in ado.net?

540


How to identify the updated rows in a dataset?

517


What are the advantages and disadvantages of using datalist?

527


What is ado.net objects?

521


What is the significance of CommandBehavior.CloseConnection ?

571


Explain the overview of ado.net architecture?

517


How to retrieve the user id which is provided while windows authentication?

588


What is difference between dataset and datatable?

511


What is the difference between dataset and datatable?

485