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

How to bind the controls(best practice) comboboxes to the data in the dataset?

792


What are advantages of microsoft-provided data provider classes in ado.net?

766


What is the difference between DataReader and DataSet in ADO.NET?

814


What is Data view?

784


How can we load multiple tables in to dataset?

799


How do you update a dataset in ado.net and how do you update database through dataset?

687


What are the main differences between classic ado and ado.net?

743


How to identify the controls which can be used for binding data?

750


What is ado.net tutorial?

689


Which architecture does Datasets follow?

797


how to create a quiz software using 4 options to answer and how to check with answers in the database and award marks....

3993


What is the difference between SqlCommand and SqlCommandBuilder?

786


Which property is used to check whether a DataReader is closed or opened?

802


How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?

769


What is a datareader object?

822