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. General Programming
  3. C#
  4. DGV Value Translation

DGV Value Translation

Scheduled Pinned Locked Moved C#
databasecsharphelpannouncement
1 Posts 1 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.
  • N Offline
    N Offline
    netizenk
    wrote on last edited by
    #1

    Hello everyone, Here is a scenario: Front End: MSVS2005 - C# - DGV Back End: MS SQL Server2005 - Stored Procedures On the backend the main table contains a column named "OfficeID", tinyint, and in another table named "Offices" there are three coulmns "OfficeID", tinyint (PK); "OfficeName", nchar; and "OfficeAbb", nchar. In my SELECT stored procedure I do an INNER JOIN of "OfficeID" columns in these two tables and display the OfficeAbb string on my front end DataGridView when I call the SELECT stored procedure instead of that tinyint stored in the main table. This works great and DGV displays the Office Abbreviation based on the tinyint stored in the OfficeID column of the main table. However, when I try to call my UPDATE stored procedure to update the main table I get "Failed to convert parameter value from a String to a Byte" because the DataSet now holds that two letter string office abbreviation and apparently the DataAdapter is not smart enough to lookup the Offices table and replace the string with the OfficeID tinyint for me. I guess I either have to use some method of the DataAdapter to instruct it to translate the string into the tinyint based on the Office table values or to change the UPDATE stored procedure to where it would accept the string and than do the value translation for me. I suspect both options are possible but was unable to Google this out despite this being such a common scenario. Any help is appreciated. Thanks for reading, Dean

    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