Re: Datatable Update

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 05/10/04


Date: Sun, 9 May 2004 22:21:29 -0400

Hi Mazda:

On the one hand, it sounds like you may be making a few more trips to the db
than you want, and perhaps using two tables with a datarelation may be a
cleaner approach. However, to address your particulary problem. If you are
using the value of a column in the row to query the db, then you can overlay
the existing values with the values you get back. Let's say you have a
datarow with 4 columns, the first of which is customer_id 100. You hit the
db with your proc which corresponds to customer_id 100. You could iterate
through a datareader (or since you are using stored procs, I'd save the
overhead and use OutPut Parameters) and set dataTable.Rows[0]1], rows [0][2]
and Rows [0][3] to each respective valeu of the datareader or the output
params.

If I undestand your problem correctly, that should work but if I don't,
please let me know and I'll see what I can come up with.

Cheers,

Bill

www.devbuzz.com
www.knowdotnet.com

"mazda_88" <rwoo_98@yahoo.com> wrote in message
news:3b202e0c.0405091630.750903f7@posting.google.com...
> Not sure where to post this, but this is the problem I am having. I
> am trying to pass an id in a datatable that will be used to query the
> database to extract the rest of the row. For example, suppose, I have
> a customer id and this id is used to query the database to extract the
> rest of the columns assoicated with the customer id. I update the
> datatable column/row 0 associated with the customer id, and then call
> a method with the datatable as an argument. This method then extracts
> the customer_id from the datatable and then executes a stored
> procedure that fills the data to the datatable. When this occurs
> another row is added to the datatable with the results from the query.
> Is there a way of doing this so that the results of the query update
> row 0?
>
> I know that there are a number of otherways of approaching the
> problem, such as passing the customer_id instead of including the
> value in the datatable. Or I could delete row 0 before executing the
> stored procedure.
>
> Thanks,



Relevant Pages

  • Re: sql server slower than MS Access
    ... update query before actually committing the results. ... The clustered index is not on the columns being updated. ... I SET ROWCOUNT in the stored procedure to 100000, the query executes ...
    (microsoft.public.sqlserver.server)
  • VB-> ADO -> ORACLE
    ... I have a oracle procedure which executes a query to access external ... have permissions to run the external query in the stored procedure) i am ... when run from sqlplus both user1 and owner can execute the stored procedure ...
    (microsoft.public.data.ado)
  • Re: noise words, @@ERROR, and stop and resume indexing
    ... > Noiseword varcharNot Null ... > the data from the noise file to the noise_words table. ... >> A clause of the query contained only ignored words. ... >> into query analyzer before starting the stored procedure. ...
    (microsoft.public.sqlserver.fulltext)
  • Re: CBO & different execution plans
    ... This is the query: ... The explain plan when the schema owner executes the query (good ... 536 TABLE ACCESS BY INDEX ROWID HTS_ASSAY_RESULT (cr=56 pr=4 pw=0 ...
    (comp.databases.oracle.server)
  • Re: CBO & different execution plans
    ... This is the query: ... The explain plan when the schema owner executes the query ... It looks to me like the public synonyms are pointing at different ...
    (comp.databases.oracle.server)