Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying data into an existing datarow
Message
From
03/04/2007 09:45:07
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01211623
Message ID:
01211631
Views:
13
Paul... you said Cursor, do you mean datatable?

There is another trick that I have used, but I can't remember it from the top of my head, and the code sample is on my home machine. If your solution hasn't been solved by tonight, I will see if I can find that code.

>I'm attempting to import data into an existing table that is being passed via XML. I've got code which creates a DataTable from it. I also grab a cursor from SQL that will be compared against the XML table. I need to either add new records to this cursor, or update an existing row. The XML data contains most, but not all of the columns in the SQL table.
>
>I'm using ImportRow() to add new records - this works OK.
>
>I'm locating matching records via DataTable.Select().
>
>What I'm looking for is an easy way to load matching columns from the XML cursor into my SQL cursor (the equivalent of SCATTER/GATHER in VFP). I can brute-force this and specify this column-by-column, but with over a 100 columns that kind of sucks. It seems like there should be an easier way to do this, but I haven't had much luck finding it. I keep looking at the ItemArray, but I don't see how I could use it, since the columns may not be in the same order everytime. I've also thought about just deleting the existing row and adding a new one, but we're going to be running this process a lot so I'd rather not.
>
>Any ideas?
>
>Thanks,
Very fitting: http://xkcd.com/386/
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform