So i am trying to do a match between filenames and a SQL dataset.
E.g. Recordset contains a array of 1000,1001,1002,1003
and my filelist contains a array of "c:\temp\100.txt","c:\temp\1000.txt","c:\temp\1001.txt","c:\temp\2002.txt","c:\temp\100.txt","c:\temp\1000-1.txt"
So my aim is to get a result of :
c:\temp\1000.txt c:\temp\1001.txt c:\temp\1000-1.txt
How do i accomplish that?
I've tried something like this
private static String[] GetImageList()
{
return Directory.GetFiles("C:\\tempbilledeimport\\", "*.*", SearchOption.AllDirectories);
}
private static List<string> SQLRecordset()
{
List<string> items = new List<string>();
string queryString = "select item from inventory where WebUseOnWeb=1";
using (SqlConnection connection = new SqlConnection(DatabaseConnection.SqlConnectionStringCompany))
{
SqlCommand command = new SqlCommand(queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
// Call Read before accessing data.
items.Add(reader[0].ToString());
reader.Close();
}
return items;
}
But how do i compare them?