gmcconville
February 23rd, 2010, 03:36 AM
Hi, need some advice please
New to Database programming, but what I want to do is update a database everyday with information I am getting from a file
So what I want to do is the following
Do until End Of File
Read ProductCode and ProductDescription from File
Record = Database.Columns["Code"].Find(ProductCode)
If no Record found then
Add a new record with ProductCode and Description
else
Update Record // Description may have changed
End If
Loop
The file may contain 4000 to 5000 records and I don't know what the best way is to search the database.
Would it be to loop through each record testing if ProductCode matches, or is there already a search feature there
I presume using DataSet.Table["Products"].Select[search criteria] would not be a good choice as its going through the loop so many times?
The database connection I have is
Adapter = new OleDbDataAdapter("Select * from Products",
@"Provider=Microsoft.JET.OLEDB.4.0;data source=C:\Stock.mdb");
Set = new DataSet();
Adapter.Fill(Set, "Products");
I hope this is easy to understand, and I appreciate your help
New to Database programming, but what I want to do is update a database everyday with information I am getting from a file
So what I want to do is the following
Do until End Of File
Read ProductCode and ProductDescription from File
Record = Database.Columns["Code"].Find(ProductCode)
If no Record found then
Add a new record with ProductCode and Description
else
Update Record // Description may have changed
End If
Loop
The file may contain 4000 to 5000 records and I don't know what the best way is to search the database.
Would it be to loop through each record testing if ProductCode matches, or is there already a search feature there
I presume using DataSet.Table["Products"].Select[search criteria] would not be a good choice as its going through the loop so many times?
The database connection I have is
Adapter = new OleDbDataAdapter("Select * from Products",
@"Provider=Microsoft.JET.OLEDB.4.0;data source=C:\Stock.mdb");
Set = new DataSet();
Adapter.Fill(Set, "Products");
I hope this is easy to understand, and I appreciate your help