Re: Datatable Update
From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 05/10/04
- Next message: Jay B. Harlow [MVP - Outlook]: "Re: Datasets vs. OOP"
- Previous message: Mark: "Re: Repost with code : Can't update an Access record.: more info."
- In reply to: mazda_88: "Datatable Update"
- Messages sorted by: [ date ] [ thread ]
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,
- Next message: Jay B. Harlow [MVP - Outlook]: "Re: Datasets vs. OOP"
- Previous message: Mark: "Re: Repost with code : Can't update an Access record.: more info."
- In reply to: mazda_88: "Datatable Update"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|