ReadOnlyException while trying to update a subquery column using TableAdapter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bogdan

    ReadOnlyException while trying to update a subquery column using TableAdapter

    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

    #2
    Re: ReadOnlyExcepti on while trying to update a subquery column using TableAdapter

    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" <Bogdan@company .comwrote in message
    news:%231cX5M$n IHA.1580@TK2MSF TNGP06.phx.gbl. ..
    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
    >
    >

    Comment

    • Bogdan

      #3
      Re: ReadOnlyExcepti on while trying to update a subquery column using TableAdapter

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

      Thanks,
      Bogdan

      "George Ter-Saakov" <gt-nsp@cardone.com wrote in message
      news:Ob5TfR$nIH A.4616@TK2MSFTN GP05.phx.gbl...
      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" <Bogdan@company .comwrote in message
      news:%231cX5M$n IHA.1580@TK2MSF TNGP06.phx.gbl. ..
      >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
      >>
      >>
      >
      >

      Comment

      • George Ter-Saakov

        #4
        Re: ReadOnlyExcepti on while trying to update a subquery column using TableAdapter

        I mean if you need to update record in the database just do something like
        (psedocode)
        con.Execute("UP DATE table SET field1 = 10 WHERE id=5")

        Something like that....

        George.


        "Bogdan" <Bogdan@company .comwrote in message
        news:O6Evon$nIH A.5096@TK2MSFTN GP02.phx.gbl...
        Thanks for the reply. Could you please explain what you meant by "issue
        UPDATE command yourself..."?
        >
        Thanks,
        Bogdan
        >
        "George Ter-Saakov" <gt-nsp@cardone.com wrote in message
        news:Ob5TfR$nIH A.4616@TK2MSFTN GP05.phx.gbl...
        >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" <Bogdan@company .comwrote in message
        >news:%231cX5M$ nIHA.1580@TK2MS FTNGP06.phx.gbl ...
        >>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
        >>>
        >>>
        >>
        >>
        >
        >

        Comment

        Working...