Hey Everyone,
I'm having an issue that I hope someone can help me out with. If I have 2 DataTables (one that reads data from a DB and one that reads from a XML file), is there a way to combine them and eliminate any records that are duplicated. What I'm trying to do is build an app for a realtor that uses a RETS Connector, and I'm required to write the data to a XML file rather than another database for reasons that really aren't worth going into. But if you aren't familiar with a RETS Connection, you have to pull the data, write it how you want, and then you can use it on your site to your liking. They limit the connections so I can't just feed off of their database.
The client wants to be able to update the properties on a daily basis, so in order to eliminate a 12-hour wait time to download the property data by starting over, I'm trying to use the current xml file to fill a data table and compare it to another data table that is created when I search the RETS feed. If I can combine the data tables after they are filled and possibly combine/sort them, then eliminate any records that are duplicated (remove the original and duplicate), that will leave me with only the new properties. Then I can take that data to do the actual request for images, etc. Did I lose you?
If anyone has any ideas or links, please send them my way. Many thanks for any help.
This is a VB.NET web application.
3 4765
Hmm, quick hack perhaps, create a third datatable that is a copy of your first, and then iterate through the second table and where each row doesn't exist, add it to the table. Now table 3 holds all the unique records...
LINQ would be a great tool for this.
Hmm, quick hack perhaps, create a third datatable that is a copy of your first, and then iterate through the second table and where each row doesn't exist, add it to the table. Now table 3 holds all the unique records...
LINQ would be a great tool for this.
Thanks for the quick reply! Do you know what the syntax is for determining if a row exists. Sorry I'm still kind of new at this stuff. I had a table.select(filterexpression) set up before and used a loop to go through and try to find records but it took forever. I'll look into LINQ, but I'm on a time limit for this, so if it's something that's going to require me to do a lot of research and code changes to implement, I think it's off the table...no pun intended :).
Thanks for the quick reply! Do you know what the syntax is for determining if a row exists. Sorry I'm still kind of new at this stuff. I had a table.select(filterexpression) set up before and used a loop to go through and try to find records but it took forever. I'll look into LINQ, but I'm on a time limit for this, so if it's something that's going to require me to do a lot of research and code changes to implement, I think it's off the table...no pun intended :).
um...not exactly sure as I've not yet had to use LINQ for an "Exists" clause...I just hacked this together, so it'll need some tweaking, but it should give you an idea: - Dim tbl1 As New DataTable 'The table from the database
-
Dim tbl2 As New DataTable 'The table from the XML (the ones we previously downloaded I'm assuming)
-
Dim qry = From x In tbl1 _
-
Where Not (From y In tbl2 _
-
Select y.Field("KeyColumn")).Contains(x.Field("KeyColumn")) _
-
Select x
-
-
For Each TableRow In qry
-
'Add the content of the row to the XML
-
Next
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Job Lot |
last post by:
Is there anyway of Joining two or more DataTable with similar structure?
I have three DataTables with following structures
Data, AmountB/F, Repayments, InterestCharged and AmountC/F
i want...
|
by: Gene Ariani |
last post by:
I have one dataset that contains two DataTables:
DataTable1:
Customer_ID
1
|
by: DraguVaso |
last post by:
Hi,
I have two DataTables (our DataViews or whatever that will suit the best for
the solution). I want to merge these two DataTables the fastest as possible,
but they have to be merged one table...
|
by: Frank |
last post by:
Hello,
Developing an app where the user fills out a sometimes quite lengthy
form of chkboxes, txtboxes, radbtns, etc. User responses are saved to
a mySql db, which the user can later edit.
When...
|
by: Frank |
last post by:
Hello All,
I am working on a vb.net app where I need to compare to 2 datatables
and determine if a string exists in one or both. The first dt is
filled from the db. A form is loaded and the...
|
by: Niyazi |
last post by:
Hi all,
What is fastest way removing duplicated value from string array using vb.net?
Here is what currently I am doing but the the array contains over 16000
items. And it just do it in 10 or...
|
by: c_shah |
last post by:
Scenario: I have to update my SQL server table from an ORACLE database
to keep my SQL table in sync with ORACLE.
I have one data table that is populated form ORACLE and other one is
populating...
|
by: bbdobuddy |
last post by:
Hi,
I have two datatables that I want to left outer join and then do some
queries on but I having a hard time figuring out how to join the datatables
together. One of the datatables comes from...
|
by: laurasaur |
last post by:
Hi everyone,
I have 2 listboxes that I need to move items between, they are both
bound to DataTables which get populated from the database with a list
of clients.
Im getting a few problems,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |