Problem of updating two tables in gridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fireburns
    New Member
    • Jan 2007
    • 1

    Problem of updating two tables in gridview

    Hello,
    I am using a GridView control which displays data from 2 SQL tables.the columns are project_name,cl ient_name which are from mstproject(its fields are project_id,proj ect_name,client _id,which is a FK to mstclient(its fields are client_id,clien t_name)respecti vely.
    When the user tries to insert/update the client_name the client_id should be stored in the table mstprojectSo even though in gridview client_name is displayed but client_id should be stored in the db.(i know it is confusing but)Plz tell the Sql command needed.
    Please help!
    Its urgent

    fireburns
  • enreil
    New Member
    • Jan 2007
    • 86

    #2
    Could you clarify a bit? Is the user updating both tables, or only the mstclient table? If only client_name is being updated in mstclient, you shouldn't need to do anything with client_id. If you are inserting a new row into client_name and want it related to mstproject, then you will need to insert a new row into mstproject that contains the client_id as a FK. There are several ways this may be accomplished, but you may try looking at some basic SQL syntax for UPDATE and INSERT commands located at http://www.mckoi.com/database/SQLSyntax.html#12

    If you can clairfy what you need accomplished, I'd be glad to help.

    Originally posted by fireburns
    Hello,
    I am using a GridView control which displays data from 2 SQL tables.the columns are project_name,cl ient_name which are from mstproject(its fields are project_id,proj ect_name,client _id,which is a FK to mstclient(its fields are client_id,clien t_name)respecti vely.
    When the user tries to insert/update the client_name the client_id should be stored in the table mstprojectSo even though in gridview client_name is displayed but client_id should be stored in the db.(i know it is confusing but)Plz tell the Sql command needed.
    Please help!
    Its urgent

    fireburns

    Comment

    Working...