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. Windows Forms
  4. Help with data update

Help with data update

Scheduled Pinned Locked Moved Windows Forms
helpdatabasesql-serversysadmintutorial
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.
  • A Offline
    A Offline
    anton 09
    wrote on last edited by
    #1

    Hello, could anyone solve my problem. I have application working with MSSQL Server: there is one table "goods" (id, name) and another one - "info" (id, idgood1, idgood2, info), where idgood1 and idggod2 - foreign keys. That is an example of what I want. "Goods" Table:

    id | name --------- 23 | foo1 24 | foo2 25 | foo3

    "Info" Table:

    id | idgood1 | idgood2 | info ----------------------------- 10 | _____23 | _____24 | inf1 11 | _____23 | _____25 | inf2 12 | _____24 | _____25 | inf3

    I want to see in DataGridView such structure (first row - row header, first column - column header):

    ____ | foo1 | foo2 | foo3 -------------------------- foo1 | ____ | inf1 | inf2 foo2 | ____ | ____ | inf3 foo3 | ____ | ____ | ____

    I select data from two tables ("goods", "info") in appropriate DataTable instances: GoodsDataTable and InfoDataTable. Then I CREATE (dynamically) one more DataTable instance - VisualDataTable, which is filled according to my needs. Then I put VisualDataTable into DataSet, DataSet into BindingSource, and, finally, BindingSource into DataGridView. It's working. Until I want to update something! I tried to call SqlAdapter's Update method as for InfoDataTable as DataSet. But nothing happens. In general, how should I update data in case when "visual" part of DataGridView and database structure are different..? Another words, I take data from database, and put data into database with one table, and I edit data with another table.

    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