using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SQLite;
using System.Data;
namespace Test
{
///
/// SQLiteHelper 的摘要说明
///
public class SQLiteHelper
{
private SQLiteHelper()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#region 静态私有方法
///
/// 附加参数
///
///
///
private static void AttachParameters(SQLiteCommand command, SQLiteParameter[] commandParameters)
{
command.Parameters.Clear();
foreach (SQLiteParameter p in commandParameters)
{
if (p.Direction == ParameterDirection.InputOutput && p.Value == null)
p.Value = DBNull.Value;
command.Parameters.Add(p);
}
}
///
/// 分配参数值
///
///
///
private static void AssignParameterValues(SQLiteParameter[] commandParameters, object[] parameterValues)
{
if (commandParameters == null || parameterValues == null)
return;
if (commandParameters.Length != parameterValues.Length)
throw new ArgumentException("Parameter count does not match Parameter Value count.");
for (int i = 0, j = commandParameters.Length; i < j; i++)
{
commandParameters[i].Value = parameterValues[i];
}
}
///
/// 预备执行command命令
///
///
///
///
///
///
///
private static void PrepareCommand(SQLiteCommand command,
SQLiteConnection connection, SQLiteTransaction transaction,
CommandType commandType, string commandText, SQLiteParameter[] commandParameters
)
{
if (commandType ==
SQLiteHelper的C#实现
最新推荐文章于 2024-01-23 21:40:37 发布