updating multiple tables

Discussion in 'ASP .Net' started by evandela@bigpond.net.au, Mar 21, 2006.

  1. Guest

    Hi all... this is one part of ASP.net that i just dont understand...
    and GOD knows, i am trying.
    I have 2 tables, the first one called country [countryID, countryName]
    and the second called product[productID, countryID, productName]

    I create a datagrid and have to custom write the sql Select command

    Up to this point it all works fine... the hitch is that i also want to
    be able to update the damned thing... here is the declaration of my
    datasource... what do I need to do? please I am a newbie here... so
    dont get to technical use easy words and if you have to swear at me,
    dont use stars, I am likley going to think that is some sort of
    variable and will try use it in some code...

    <asp:AccessDataSource ID="countryList" runat="server"
    DataFile="~/App_Data/products.mdb"
    SelectCommand="SELECT country.*, product.* FROM country, product
    WHERE country.countryID = product.countryID;"
    ConflictDetection="CompareAllValues"
    OldValuesParameterFormatString="original_{0}"
    UpdateCommand="UPDATE Product SET [cost]=? WHERE [countryID]=? AND
    [productID]=?">
    <UpdateParameters>
    <asp:parameter Name="cost" Type="int32" />
    <asp:parameter Name="countryID" Type="int32" />
    <asp:parameter Name="productID" Type="int32" />
    </UpdateParameters>
    </asp:AccessDataSource>

    How does asp.net KNOW what values to put into the update parameters ?
    and what do you guys think I am missing here ?

    Evan
     
    , Mar 21, 2006
    #1
    1. Advertising

  2. Evandela,

    I can't really answer your question exactly, but I can point you to a
    tutorial that I think may help your understanding:

    http://msdn2.microsoft.com/en-us/library/ms178294.aspx

    The link above is to a tutorial on adding a dropdownlist to the edit area of
    a gridview control (all without coding) so that the items to choose from in
    the gridview (linked via PrimaryKey) in the main table are selectable in the
    dropdown and the primary key gets updated in the original table.

    It should be a good start for you to understand what's going on. (I hope.)

    Regards,

    --
    S. Justin Gengo
    Web Developer / Programmer

    Free code library:
    http://www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche


    <> wrote in message
    news:...
    > Hi all... this is one part of ASP.net that i just dont understand...
    > and GOD knows, i am trying.
    > I have 2 tables, the first one called country [countryID, countryName]
    > and the second called product[productID, countryID, productName]
    >
    > I create a datagrid and have to custom write the sql Select command
    >
    > Up to this point it all works fine... the hitch is that i also want to
    > be able to update the damned thing... here is the declaration of my
    > datasource... what do I need to do? please I am a newbie here... so
    > dont get to technical use easy words and if you have to swear at me,
    > dont use stars, I am likley going to think that is some sort of
    > variable and will try use it in some code...
    >
    > <asp:AccessDataSource ID="countryList" runat="server"
    > DataFile="~/App_Data/products.mdb"
    > SelectCommand="SELECT country.*, product.* FROM country, product
    > WHERE country.countryID = product.countryID;"
    > ConflictDetection="CompareAllValues"
    > OldValuesParameterFormatString="original_{0}"
    > UpdateCommand="UPDATE Product SET [cost]=? WHERE [countryID]=? AND
    > [productID]=?">
    > <UpdateParameters>
    > <asp:parameter Name="cost" Type="int32" />
    > <asp:parameter Name="countryID" Type="int32" />
    > <asp:parameter Name="productID" Type="int32" />
    > </UpdateParameters>
    > </asp:AccessDataSource>
    >
    > How does asp.net KNOW what values to put into the update parameters ?
    > and what do you guys think I am missing here ?
    >
    > Evan
    >
     
    S. Justin Gengo, Mar 21, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shiv
    Replies:
    0
    Views:
    426
  2. =?Utf-8?B?SnVzdGlu?=

    Updating multiple Tables

    =?Utf-8?B?SnVzdGlu?=, Nov 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,739
    Daniel Fisher\(lennybacon\)
    Nov 22, 2004
  3. MRW

    Updating 2 Tables at once

    MRW, Aug 20, 2006, in forum: ASP .Net
    Replies:
    10
    Views:
    602
  4. news.rcn.com
    Replies:
    2
    Views:
    1,180
    Roedy Green
    Dec 10, 2007
  5. aspshadow

    ASP Gridview Updating Two Tables

    aspshadow, Mar 16, 2009, in forum: .NET
    Replies:
    0
    Views:
    502
    aspshadow
    Mar 16, 2009
Loading...

Share This Page