Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Typed DataSets and casting problems...

Typed DataSets and casting problems...

Scheduled Pinned Locked Moved Database
comhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andrew Connell
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • A Andrew Connell

      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

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      does InventoryRow directly inherit from DataRow? if not there might be problems casting it

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups