NetQuickJamesFrame/DBHelp/SQLite.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Linq;
using System.Text;
namespace NetQuickJamesFrame.DBHelp
{
public class SQLite
{
private string dbPath;
public SQLite(string dbPath)
{
this.dbPath = dbPath;
}
/// <summary>
/// ExecuteNonQuery using for insert, update, delete
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public int executeNonQuery(string sql)
{
int result = -1;
SQLiteConnection conn = new SQLiteConnection("data source=" + dbPath);
try
{
if (conn.State != System.Data.ConnectionState.Open)
{
conn.Open();
SQLiteCommand cmd = new SQLiteCommand(sql, conn);
result = cmd.ExecuteNonQuery();
conn.Close();
}
}
catch (Exception ex)
{
conn.Close();
throw new Exception(ex.Message);
}
return result;
}
/// <summary>
/// executeReader using for select
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public List<string> executeReader(string sql)
{
List<string> result = new List<string>();
SQLiteConnection conn = new SQLiteConnection("data source=" + dbPath);
try
{
if (conn.State != System.Data.ConnectionState.Open)
{
conn.Open();
SQLiteCommand cmd = new SQLiteCommand(sql, conn);
后面还有 24 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
