C# IF statement against SQLite query result
        Posted  
        
            by jakesankey
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by jakesankey
        
        
        
        Published on 2010-05-25T18:25:40Z
        Indexed on 
            2010/05/25
            18:31 UTC
        
        
        Read the original article
        Hit count: 235
        
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
© Stack Overflow or respective owner