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();
    }
}

 

 

 

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

相关文章:

  • 2022-12-23
  • 2022-02-23
  • 2021-12-22
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
猜你喜欢
  • 2022-12-23
  • 2021-04-24
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
相关资源
相似解决方案