Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ReadOnlyException while trying to update a subquery column using TableAdapter

Reply
Thread Tools

ReadOnlyException while trying to update a subquery column using TableAdapter

 
 
Bogdan
Guest
Posts: n/a
 
      04-16-2008
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


 
Reply With Quote
 
 
 
 
George Ter-Saakov
Guest
Posts: n/a
 
      04-16-2008
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" <(E-Mail Removed)> wrote in message
news:%231cX5M$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Bogdan
Guest
Posts: n/a
 
      04-16-2008
Thanks for the reply. Could you please explain what you meant by "issue
UPDATE command yourself..."?

Thanks,
Bogdan

"George Ter-Saakov" <(E-Mail Removed)> wrote in message
news:Ob5TfR$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%231cX5M$(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
George Ter-Saakov
Guest
Posts: n/a
 
      04-16-2008
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" <(E-Mail Removed)> wrote in message
news:O6Evon$(E-Mail Removed)...
> Thanks for the reply. Could you please explain what you meant by "issue
> UPDATE command yourself..."?
>
> Thanks,
> Bogdan
>
> "George Ter-Saakov" <(E-Mail Removed)> wrote in message
> news:Ob5TfR$(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:%231cX5M$(E-Mail Removed)...
>>> 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
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Data.SqlClient.SqlException: Subquery returned more than 1 value. Rod ASP .Net 6 12-22-2009 05:12 PM
ObjectDatasource cannot find a non generic update method when using TableAdapter and deploying using WebSetUp Project rote ASP .Net 0 08-01-2008 07:24 AM
XQuery equivalent to NOT IN (subquery) thecolour XML 2 06-26-2007 01:13 PM
SQL Subquery and alias for datagrid use .Net Sports ASP .Net 2 07-07-2005 02:34 AM
Count(*) in a Subquery with multiple tables: How does SQL determine which table to generate the Count() from? Kaimuri MCSD 3 12-29-2004 06:38 PM



Advertisments