Click here to Skip to main content
15,905,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
For good or ill, I'm using DataSets with TableAdapters to update some columns in an Oracle db table. My update has is using a parameter 3 times in the update statement and I keep getting the error 'ORA-01008: not all variables bound'. I'm pretty sure if I can set the BindByName to true for the Command it will work. However, I am having a hard time figuring out how to get to the command in the tableadapter.

Any help would be appreciated.
Posted

1 solution

Of course, I fight with this forever and then I send in a question, only to discover the answer myself shortly after.

I'm doing this to make sure the BindByName is set on everything, but more specific items can be written if you only want one of the commands to have the BindByName set.

The table adapters have partial classes so you can add methods and properties to make life easier.

C#
namespace MyTableAdapters
{
    public partial class MyTabTableAdapter
    {
        public bool SetBindByName
        {
            set
            {
                this.Adapter.InsertCommand.BindByName = value;
                this.Adapter.UpdateCommand.BindByName = value;
                this.Adapter.DeleteCommand.BindByName = value;
                foreach (Oracle.DataAccess.Client.OracleCommand cmd in this.CommandCollection)
                {
                    cmd.BindByName = value;
                }
            }
        }
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900