SQLiteApplication/DB/DatabaseHelper.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SQLite;
using NetQuickJamesFrame.Log;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace SQLiteApplication.DB
{
class DatabaseHelper
{
LogHelper LOGGER = new LogHelper();
/// <summary>
/// create DB
/// </summary>
/// <returns></returns>
public int CreateDB(string DBName)
{
try
{
SQLiteConnection.CreateFile(DBName);
return 0;
}
catch (Exception ex)
{
LOGGER.writeLog(LogHelper.LOG_LEVEL.ERROR, ex.Message);
throw new Exception("create " + DBName + " failed", ex);
}
}
/// <summary>
/// create Table
/// </summary>
/// <param name="tableName"></param>
/// <param name="col_Type"></param>
/// <returns></returns>
public int createTable(string tableName, Dictionary<string, string> col_Type)
{
string dbPath = Application.StartupPath + "\\" + Conf.dbDirect + "\\" + Conf.dbName;
int result = -1;
SQLiteConnection conn = new SQLiteConnection("data source=" + dbPath);
try
{
if (conn.State != System.Data.ConnectionState.Open)
{
conn.Open();
SQLiteCommand cmd = new SQLiteCommand();
cmd.Connection = conn;
string col_Type_Str = toTableCol(col_Type);
cmd.CommandText = " CREATE TABLE " + tableName + " ( " + col_Type_Str + " ) ";
return cmd.ExecuteNonQuery();
}
}
catch (Exception ex)
{
后面还有 193 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
