C# IF statement against SQLite query result
- by jakesankey
I have a C# application that I am attempting to check my sqlite db if a filename already exists in the FileName column, if it DOESN'T exist, execute some code.. Here is what I am working with.
string[] files = Directory.GetFiles(@"C:\Documents and Settings\js91162\Desktop ", "R303717*.txt*", SearchOption.AllDirectories);
foreach (string file in files)
{
string FileNameExt1 = Path.GetFileName(file);
insertCommand.CommandText =
@"
SELECT * FROM Import WHERE FileName == FileNameExt1;";
}
string contYes = insertCommand.ExecuteNonQuery();
if (string.IsNullOrEmpty(contYes))
{
//more code
}
EDIT: added space in path so that slash doesn't eat quotation mark