1

I have a legacy DAL with like 100 TableAdapters (DataSet xsd) but because we got new servers with Oracle client 12c I had to made the switch to the Oracle.DataAccess.Client (ODP.NET) from the old deprecated System.Data.OracleClient.

The only problem I have now is that I always get an error: ORA-01008: Not all variables bound when calling the Table Adapters.

I read that I have to set BindByName to true in OracleCommand for each TableAdapter. But how can I do that when the only place where OracleCommand is used is in the designer of the TableAdapter itself?

Is there some way to do this without extending each TableAdapter, because I have like 100 of them.

4

1 回答 1

0

我所做的是扩展了每个 TableAdapter 并创建了一个新SetBindByName()方法,我在其中强制BindByName = true使用 OracleCommand 集合。

像这样...

public partial class V_CUSTOMER_GLOBALTableAdapter
{
    public void SetBindByName(bool value = true)
    {
        foreach (Oracle.DataAccess.Client.OracleCommand cmd in this.CommandCollection)
        {
            cmd.BindByName = value;
        }
    }
}

然后,当我创建 TableAdapter 的一个实例时,我调用了新SetBindByName()方法。

V_CUSTOMER_GLOBALTableAdapter ta = new V_CUSTOMER_GLOBALTableAdapter();
ta.SetBindByName(true);
于 2015-08-30T00:19:43.573 回答