Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1145
Referencing column names from GetChanges dataset?
posted

I normally would not ask such a question so soon with so little research, but...

I first get all grid changes into a dataset:
DataSet ds = _lkpData.GetChanges();

I then loop through the dataset and build a parameter array to pass to an SQL stored procedure call, etc.

foreach (DataRow r in ds.Tables[0].Rows)
{
  SqlParameter[] sqlParms = new SqlParameter[] {
    new SqlParameter("@RecordID",r.ItemArray[0]),
    new SqlParameter("@FinalPnL",r.ItemArray[4]),
    new SqlParameter("@FinalNAV",r.ItemArray[5]),
    new SqlParameter("@FinalReturn",r.ItemArray[6])};
    
My issue is referencing columns by name.  The only thing I've found so far is the ItemArray collection, which works, but I need to disable the grid's column moving feature so the columns are always where I expect them to be.

I hope this is simply a matter of doing things the "hard way"?

Thanks in advance!