C# sqlite执行sql

C# sqlite执行sql

 

/// <summary>
/// 执行增删改查操作
/// </summary>
/// <param name="sql">查询语言</param>
/// <returns></returns>
public static int ExecuteNonQuery(string db, string sql)
{
    try
    {
        SQLiteCommand cmd;
        cmd = new SQLiteCommand(sql, dbConnection(db));
        cmd.ExecuteNonQuery().ToString();
        return 1;
    }
    catch (Exception ex)
    {
        Console.WriteLine("ExecuteNonQuery(" + sql + ")Err:" + ex.Message);
        return 0;
    }
    finally
    {
        closeConn();
    }
}

 

 

 

###########################

上一篇:玩转SQLite3:SQLite图形软件基本操作


下一篇:Sqlite源码解读(十)