使用OleDb连接对C#的访问

时间:2014-02-20 15:50:09

标签: c# database oledbconnection

你如何使用OleDbConnection并且它比使用.NET提供的框架更好?

1 个答案:

答案 0 :(得分:0)

using (OracleConnection connection = new OracleConnection("Connection String"))
{   
    using (OracleCommand cmd = new OracleCommand("select * from tbl", connection))
    {
        connection.Open();
        //do database stuff
    }
}

这是大多数数据连接的基本结构 我在这里使用了oracle 你可以用OleDb,Ibm.Iseries,SQL Server .....替换oracle。

相关问题