📄 sqlstore.cs
字号:
SqlConn.Close();
return update;
}
/// <summary>
/// 删除搜索记录
/// </summary>
/// <param name="searchid">ID</param>
public static void SqlSearchDel(long searchid)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_search_del", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@searchid", SqlDbType.BigInt).Value = searchid;
comm.ExecuteNonQuery();
comm.Dispose();
SqlConn.Close();
}
/// <summary>
/// 处理完搜索记录打标记
/// </summary>
/// <param name="searchid">ID</param>
public static void SqlSearchDeal(long searchid)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_search_deal", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@searchid", SqlDbType.BigInt).Value = searchid;
comm.ExecuteNonQuery();
comm.Dispose();
SqlConn.Close();
}
/// <summary>
/// 插入错误记录
/// </summary>
/// <param name="topicid">小说ID</param>
/// <param name="chapterid">章节ID</param>
public static void SqlErrorInsert(int topicid, int chapterid)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_error_insert", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@topicid", SqlDbType.Int).Value = topicid;
comm.Parameters.Add("@chapterid", SqlDbType.Int).Value = chapterid;
comm.ExecuteNonQuery();
comm.Dispose();
SqlConn.Close();
}
/// <summary>
/// 删除错误记录
/// </summary>
/// <param name="errorid">ID</param>
public static void SqlErrorDel(long errorid)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_error_del", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@errorid", SqlDbType.BigInt).Value = errorid;
comm.ExecuteNonQuery();
comm.Dispose();
SqlConn.Close();
}
/// <summary>
/// 后台读取小说简介
/// </summary>
/// <param name="topicid">小说ID</param>
/// <param name="boardid">版块ID</param>
/// <param name="title">名称</param>
/// <param name="pic">封面</param>
/// <param name="intro">介绍</param>
/// <param name="path">介绍</param>
/// <returns></returns>
public static DataTable SqlManageEditRead(int topicid, out int boardid, out string title, out string pic, out string intro,out string path)
{
DataTable table = new DataTable();
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_manage_edit_read", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@topicid", SqlDbType.Int).Value = topicid;
comm.Parameters.Add("@boardid", SqlDbType.Int).Direction = ParameterDirection.Output;
comm.Parameters.Add("@title", SqlDbType.NVarChar, 100).Direction = ParameterDirection.Output;
comm.Parameters.Add("@pic", SqlDbType.NVarChar, 80).Direction = ParameterDirection.Output;
comm.Parameters.Add("@intro", SqlDbType.NVarChar, 3000).Direction = ParameterDirection.Output;
comm.Parameters.Add("@path", SqlDbType.NVarChar, 3000).Direction = ParameterDirection.Output;
SqlDataAdapter data = new SqlDataAdapter(comm);
data.Fill(table);
data.Dispose();
boardid = (int)comm.Parameters["@boardid"].Value;
title = (string)comm.Parameters["@title"].Value;
pic = (string)comm.Parameters["@pic"].Value;
intro = (string)comm.Parameters["@intro"].Value;
path = (string)comm.Parameters["@path"].Value;
comm.Dispose();
SqlConn.Close();
return table;
}
/// <summary>
/// 后台修改小说
/// </summary>
/// <param name="topicid">小说ID</param>
/// <param name="boardid">版块ID</param>
/// <param name="title">名称</param>
/// <param name="intro">介绍</param>
/// <param name="cover">封面</param>
public static void SqlManageEditModTopic(int topicid,int boardid,string title,string intro,string cover)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_manage_edit_mod_topicid", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@topicid", SqlDbType.Int).Value = topicid;
comm.Parameters.Add("@boardid", SqlDbType.Int).Value = boardid;
comm.Parameters.Add("@title", SqlDbType.NVarChar, 100).Value = title;
comm.Parameters.Add("@intro", SqlDbType.NVarChar, 3000).Value = intro;
comm.Parameters.Add("@cover", SqlDbType.NVarChar, 80).Value = cover;
comm.ExecuteNonQuery();
comm.Dispose();
SqlConn.Close();
}
/// <summary>
/// 修改小说章节标题
/// </summary>
/// <param name="topicid">小说ID</param>
/// <param name="chapterid">章节ID</param>
/// <param name="length">章节内容长度</param>
/// <param name="chapter">章节标题</param>
public static void SqlManageEditModChapter(int topicid, int chapterid,int length, string chapter)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_manage_edit_mod_chapter", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@topicid", SqlDbType.Int).Value = topicid;
comm.Parameters.Add("@chapterid", SqlDbType.Int).Value = chapterid;
comm.Parameters.Add("@length", SqlDbType.Int).Value = length;
comm.Parameters.Add("@chapter", SqlDbType.NVarChar, 80).Value = chapter;
comm.ExecuteNonQuery();
comm.Dispose();
SqlConn.Close();
}
/// <summary>
/// 无搜索结果情况下打标记
/// </summary>
/// <param name="keys">搜索内容</param>
public static void SqlSearchKeys(string keys)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_search_mark", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@keys", SqlDbType.NVarChar, 100).Value = keys;
comm.ExecuteNonQuery();
comm.Dispose();
SqlConn.Close();
}
/// <summary>
/// 删除章节记录
/// </summary>
/// <param name="topicid">小说ID</param>
/// <param name="chapterid">章节ID</param>
public static void SqlDelChapter(int topicid,int chapterid)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_delchapter", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@topicid", SqlDbType.Int).Value = topicid;
comm.Parameters.Add("@chapterid", SqlDbType.Int).Value = chapterid;
comm.ExecuteNonQuery();
comm.Dispose();
SqlConn.Close();
}
/// <summary>
/// 生成周排行与推荐的js文件
/// </summary>
/// <param name="boardid">版块ID</param>
/// <returns></returns>
public static DataSet SqlJs(int boardid)
{
DataSet dataset = new DataSet();
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_js", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@boardid", SqlDbType.Int).Value = boardid;
SqlDataAdapter data = new SqlDataAdapter(comm);
data.Fill(dataset);
data.Dispose();
comm.Dispose();
SqlConn.Close();
return dataset;
}
/// <summary>
/// DIY返回章节存放路径
/// </summary>
/// <param name="topicid">小说ID</param>
/// <param name="path">路径</param>
/// <param name="filename">文件名</param>
/// <returns></returns>
public static DataTable SqlDiyPath(int topicid, out string path, out string filename)
{
DataTable table = new DataTable();
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_diy_path", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@topicid", SqlDbType.Int).Value = topicid;
comm.Parameters.Add("@path", SqlDbType.NVarChar, 50).Direction = ParameterDirection.Output;
comm.Parameters.Add("@filename", SqlDbType.NVarChar,80).Direction = ParameterDirection.Output;
SqlDataAdapter data = new SqlDataAdapter(comm);
data.Fill(table);
data.Dispose();
path = (string)comm.Parameters["@path"].Value;
filename = (string)comm.Parameters["@filename"].Value;
comm.Dispose();
SqlConn.Close();
return table;
}
/// <summary>
/// ERROR
/// </summary>
/// <param name="topicid">小说ID</param>
/// <returns></returns>
public static string SqlTopicError(int topicid)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_topic_error", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@topicid", SqlDbType.Int).Value = topicid;
comm.Parameters.Add("@title", SqlDbType.NVarChar,100).Direction = ParameterDirection.Output;
comm.ExecuteNonQuery();
string title = (string)comm.Parameters["@title"].Value;
comm.Dispose();
SqlConn.Close();
return title;
}
/// <summary>
/// 后台手动新增章节
/// </summary>
/// <param name="topicid">小说ID</param>
/// <param name="chapter">章节名称</param>
/// <param name="filename">文件名</param>
/// <param name="length">内容长度</param>
public static void SqlManual(int topicid,string chapter,string filename,long length)
{
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_manual_chapter", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@topicid", SqlDbType.Int).Value = topicid;
comm.Parameters.Add("@chapter", SqlDbType.NVarChar, 60).Value = chapter;
comm.Parameters.Add("@path", SqlDbType.NVarChar, 80).Value = filename;
comm.Parameters.Add("@length", SqlDbType.BigInt).Value = length;
comm.ExecuteNonQuery();
comm.Dispose();
SqlConn.Close();
}
/// <summary>
/// 返回表集合
/// </summary>
/// <param name="command">SQL命令</param>
/// <returns></returns>
public static DataSet SqlTable(string command)
{
DataSet dataset = new DataSet();
SqlConnection SqlConn = new SqlConnection(connection);
SqlConn.Open();
SqlCommand comm = new SqlCommand("novel_exec_table", SqlConn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@command", SqlDbType.NVarChar,200).Value = command;
SqlDataAdapter data = new SqlDataAdapter(comm);
data.Fill(dataset);
data.Dispose();
comm.Dispose();
SqlConn.Close();
return dataset;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -