如何使用C ++ .net中的Oracle

时间:2012-02-10 06:49:23

标签: .net oracle c++-cli

当我尝试编译我的代码时,我有错误

  

错误C3673:Oracle :: DataAccess :: Client :: OracleDataReader:该类没有复制构造函数

我找不到OracleDataReader组件。有代码

    Form1(void)
    {
        InitializeComponent();
        String^ ConStr = "User Id=user;Password=password;" +
                        "Data Source=db;";
        oracleConnection1->ConnectionString= ConStr;
        oracleConnection1->Open();  

        oracleCommand1->Connection= oracleConnection1;
        oracleCommand1->CommandText = "select * from sometable";
        oracleCommand1->CommandType = CommandType.Text;
        oracleCommand1->ExecuteNonQuery();
                OracleDataReader data= gcnew  Oracle::DataAccess::Client::OracleCommand() ;
        data  = cmd.ExecuteReader();
    }

谁能说出我做错了什么?

P.S。我使用VS Express Edition。

1 个答案:

答案 0 :(得分:0)

Form1(void)
    {
        InitializeComponent();
        String^ ConStr = "User Id=user;Password=password;" +
                        "Data Source=db;";
        oracleConnection1->ConnectionString= ConStr;
        oracleConnection1->Open();  
        Oracle::DataAccess::Client::OracleCommand oracleCommand1 = gcnew Oracle::DataAccess::Client::OracleCommand(oracleConnection1); 
        // get query results
        oracleCommand1->Connection= oracleConnection1;
        oracleCommand1->CommandText = "select * from sometable";
        oracleCommand1->CommandType = CommandType.Text;
        OracleDataReader _OracleDataReader = _oracleCommand1->ExecuteReader();

    }