If you want to do it in c# you can do it in this fashion.
1. Get the relevant columns from Oracle into
DataTable dtOracle
Populating a DataSet from a DataAdapter[
^]
(The same appraoch can be used for a
DataTable
as well)
2. Get the relevant columns from Excel into
DataTable dtExcel
For this you can use OleDb.
Reading and Writing Excel using OLEDB[
^]
Excel connection strings[
^]
3. Then you implement a method to find the matching columns
3a. Loop through all rows in
dtExcel
and check if the vehicle number exists in
dtOracle
.
This sample is pretty straight forward, however not very efficient
foreach (DataRow drExcel in dtExcel.Rows)
{
DataRow drOracle = dtOracle.Select(String.Format("vehicle_number = '{0}'", drExcel ["vehicle_number"])).FirstOrDefualt();
if (drOracle != null)
{
}
}
3b. Use LINQ to do the job.
Queries in LINQ to DataSet[
^]
C# - using LINQ to Query DataTable[
^]