SQLiteFunction Einfach Nicht Funktioniert

Ich ein versucht, eine SQLiteFunction aus meinem C# und ADO.NET code. Kann mir jemand sagen, warum ich dieses problem?

Eine nicht behandelte Ausnahme des Typs 'System.Daten.SQLite.SQLiteException " ist in System.Data.SQLite.dll
Zusätzliche Informationen: SQLite error in der Nähe von "DEMOIT": syntax error

Ich bin mit .NET 3.5 x86 mit SQLite ADO.NET 1.0.65 - Hilfe!!!

public class Program
    {
        static void Main( string[ args )
        {
            test();
        }


        public static void test()
        {
            SQLiteConnection sqlConn = new SQLiteConnection( "Data Source=TestFoods.db;" );
            sqlConn.Open();
            SQLiteCommand sqlCmd = new SQLiteCommand( "PRAGMA integrity_check" , sqlConn);
            sqlCmd.ExecuteNonQuery();
            SQLiteFunction.RegisterFunction( typeof(DEMOIT) );
            sqlCmd = new SQLiteCommand( "SELECT * FROM Foods Where Foods.Name DEMOIT '$butter' " , sqlConn );
            sqlCmd.CommandType = CommandType.Text;
            SQLiteDataAdapter liteAdapter = new SQLiteDataAdapter( sqlCmd );
            DataSet dataSet = new DataSet();
            liteAdapter.Fill( dataSet , "Foods" );
        }

    }

    [SQLiteFunction( Name = "DEMOIT" , Arguments = 1 , FuncType = FunctionType.Scalar )]
    public class DEMOIT : SQLiteFunction
    {
        public override object Invoke( object[] args )
        {
            return Convert.ToString( args[0] ) ;
        }
    }

Dank!

  • Es ist ein syntax Fehler in deiner SQL. In der Nähe von DEMOIT.
InformationsquelleAutor Snowy | 2009-12-22
Schreibe einen Kommentar