DataTable NetPurch = new DataTable();
DataColumn[] Acct_n_Prod = new DataColumn[2];
DataColumn Account;
Account = new DataColumn();
Account.DataType = typeof(string);
Account.ColumnName = "Acct";
DataColumn Product;
Product = new DataColumn();
Product.DataType = typeof(string);
Product.ColumnName = "Prod";
NetPurch.Columns.Add(Account);
NetPurch.Columns.Add(Product);
Acct_n_Prod[0] = Account;
Acct_n_Prod[1] = Product;
NetPurch.PrimaryKey = Acct_n_Prod;
NetPurch.Columns.Add(MoreColumns);
the code is based on the example here
When it is compiled and runs i get an error saying:
"Expecting 2 values for the key being indexed but received only one"
if I make Acct_n_Prod = new DataColumn[1]
and comment out the line adding product to the acct-n-prod array then it runs fine
I'm fairly new to this so I'm not sure where the error is
Thanks,
-Mike