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. To clarify - This code doesnt work.. it says I cannot convert insertCommand.ExecuteNonQuery to a string. I need to query the table and if the file name Does Not exist, then continue.
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