ReadOnlyException while trying to update a subquery column using TableAdapter

Discussion in 'ASP .Net' started by Bogdan, Apr 16, 2008.

  1. Bogdan

    Bogdan Guest

    Hi,

    I've been struggling subqueries/joins and table adapters for some time and
    can't find a clear answer.

    I have a stored procedure that returns columns from 2 tables. Two columns
    from the second table are returned by subquery. All this is done in a
    stored procedure.

    I also have a stored procedure that takes most of the params from the select
    proc and updates both tables.

    The problem is that columns from the second table (i.e. from a subquery)
    seem to be read-only in the auto-generated table adapter.

    I'm stuck and don't really know how to proceed. It seems like an extremely
    simple thing to do outside of asp.net. Unfortunately I'm relatively new to
    asp.net and not quite sure how to deal with it.

    So, how do I pass parameters to the stored procedure that updates both
    tables?

    I'd appreciate _any_ suggestions.
    Thanks,
    Bogdan
     
    Bogdan, Apr 16, 2008
    #1
    1. Advertising

  2. As a general rule you should not be updating queries that are results of
    Join operation...
    Instead issue UPDATE command yourself...

    Actually that is how it works behind the scene anyway.

    George.

    "Bogdan" <> wrote in message
    news:%231cX5M$...
    > Hi,
    >
    > I've been struggling subqueries/joins and table adapters for some time and
    > can't find a clear answer.
    >
    > I have a stored procedure that returns columns from 2 tables. Two columns
    > from the second table are returned by subquery. All this is done in a
    > stored procedure.
    >
    > I also have a stored procedure that takes most of the params from the
    > select proc and updates both tables.
    >
    > The problem is that columns from the second table (i.e. from a subquery)
    > seem to be read-only in the auto-generated table adapter.
    >
    > I'm stuck and don't really know how to proceed. It seems like an
    > extremely simple thing to do outside of asp.net. Unfortunately I'm
    > relatively new to asp.net and not quite sure how to deal with it.
    >
    > So, how do I pass parameters to the stored procedure that updates both
    > tables?
    >
    > I'd appreciate _any_ suggestions.
    > Thanks,
    > Bogdan
    >
    >
     
    George Ter-Saakov, Apr 16, 2008
    #2
    1. Advertising

  3. Bogdan

    Bogdan Guest

    Thanks for the reply. Could you please explain what you meant by "issue
    UPDATE command yourself..."?

    Thanks,
    Bogdan

    "George Ter-Saakov" <> wrote in message
    news:Ob5TfR$...
    > As a general rule you should not be updating queries that are results of
    > Join operation...
    > Instead issue UPDATE command yourself...
    >
    > Actually that is how it works behind the scene anyway.
    >
    > George.
    >
    > "Bogdan" <> wrote in message
    > news:%231cX5M$...
    >> Hi,
    >>
    >> I've been struggling subqueries/joins and table adapters for some time
    >> and can't find a clear answer.
    >>
    >> I have a stored procedure that returns columns from 2 tables. Two
    >> columns from the second table are returned by subquery. All this is done
    >> in a stored procedure.
    >>
    >> I also have a stored procedure that takes most of the params from the
    >> select proc and updates both tables.
    >>
    >> The problem is that columns from the second table (i.e. from a subquery)
    >> seem to be read-only in the auto-generated table adapter.
    >>
    >> I'm stuck and don't really know how to proceed. It seems like an
    >> extremely simple thing to do outside of asp.net. Unfortunately I'm
    >> relatively new to asp.net and not quite sure how to deal with it.
    >>
    >> So, how do I pass parameters to the stored procedure that updates both
    >> tables?
    >>
    >> I'd appreciate _any_ suggestions.
    >> Thanks,
    >> Bogdan
    >>
    >>

    >
    >
     
    Bogdan, Apr 16, 2008
    #3
  4. I mean if you need to update record in the database just do something like
    (psedocode)
    con.Execute("UPDATE table SET field1 = 10 WHERE id=5")

    Something like that....

    George.


    "Bogdan" <> wrote in message
    news:O6Evon$...
    > Thanks for the reply. Could you please explain what you meant by "issue
    > UPDATE command yourself..."?
    >
    > Thanks,
    > Bogdan
    >
    > "George Ter-Saakov" <> wrote in message
    > news:Ob5TfR$...
    >> As a general rule you should not be updating queries that are results of
    >> Join operation...
    >> Instead issue UPDATE command yourself...
    >>
    >> Actually that is how it works behind the scene anyway.
    >>
    >> George.
    >>
    >> "Bogdan" <> wrote in message
    >> news:%231cX5M$...
    >>> Hi,
    >>>
    >>> I've been struggling subqueries/joins and table adapters for some time
    >>> and can't find a clear answer.
    >>>
    >>> I have a stored procedure that returns columns from 2 tables. Two
    >>> columns from the second table are returned by subquery. All this is
    >>> done in a stored procedure.
    >>>
    >>> I also have a stored procedure that takes most of the params from the
    >>> select proc and updates both tables.
    >>>
    >>> The problem is that columns from the second table (i.e. from a subquery)
    >>> seem to be read-only in the auto-generated table adapter.
    >>>
    >>> I'm stuck and don't really know how to proceed. It seems like an
    >>> extremely simple thing to do outside of asp.net. Unfortunately I'm
    >>> relatively new to asp.net and not quite sure how to deal with it.
    >>>
    >>> So, how do I pass parameters to the stored procedure that updates both
    >>> tables?
    >>>
    >>> I'd appreciate _any_ suggestions.
    >>> Thanks,
    >>> Bogdan
    >>>
    >>>

    >>
    >>

    >
    >
     
    George Ter-Saakov, Apr 16, 2008
    #4
    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. Rod
    Replies:
    6
    Views:
    8,752
  2. .Net Sports

    SQL Subquery and alias for datagrid use

    .Net Sports, Jul 6, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    683
    =?Utf-8?B?bWFyc2hhbA==?=
    Jul 7, 2005
  3. thecolour
    Replies:
    2
    Views:
    2,475
    thecolour
    Jun 26, 2007
  4. Bogdan
    Replies:
    4
    Views:
    3,037
    Bogdan
    Apr 17, 2008
  5. rote
    Replies:
    0
    Views:
    328
Loading...

Share This Page