Typed DataSets and casting problems...
-
Sorry for cross-post... realized this is the more appropriate group after I sent the first one: I've created a strongly typed dataset but whenever I try to select rows from a table and try to cast the rows, I'm getting an error "Specified cast is not valid.". I have a table named "Inventory". I'm able to select rows and place them in a variable with type DataRow[]. However, when I try to cast it to a InventoryRow, I get errors every time. Here's the code: my dataset name is PADS... working code:
DataRow[] recordArray = this._dataSet.Inventory.Select();
error code:PADS.InventoryRow[] recordArray = (PADS.InventoryRow[])this._dataSet.Inventory.Select();
I'm certain I'm using the correct variable names because I'm able to easily create new records with the following:PADS.InventoryRow record = this._dataSet.Inventory.NewInventoryRow(); this._dataSet.Inventory.AddInventoryRow(record);
Any input would be greatly appreciated! Andrew Connell, MCDBA IM on MSN andrew@aconnell.com Andrew Connell, MCDBA IM on MSN andrew@aconnell.com -
Sorry for cross-post... realized this is the more appropriate group after I sent the first one: I've created a strongly typed dataset but whenever I try to select rows from a table and try to cast the rows, I'm getting an error "Specified cast is not valid.". I have a table named "Inventory". I'm able to select rows and place them in a variable with type DataRow[]. However, when I try to cast it to a InventoryRow, I get errors every time. Here's the code: my dataset name is PADS... working code:
DataRow[] recordArray = this._dataSet.Inventory.Select();
error code:PADS.InventoryRow[] recordArray = (PADS.InventoryRow[])this._dataSet.Inventory.Select();
I'm certain I'm using the correct variable names because I'm able to easily create new records with the following:PADS.InventoryRow record = this._dataSet.Inventory.NewInventoryRow(); this._dataSet.Inventory.AddInventoryRow(record);
Any input would be greatly appreciated! Andrew Connell, MCDBA IM on MSN andrew@aconnell.com Andrew Connell, MCDBA IM on MSN andrew@aconnell.com