systemsp.cs
来自「ASP.NET 2.0动态网站设计实例源代码,本书介绍了ASP.NET2.0的基」· CS 代码 · 共 76 行
CS
76 行
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
//获取指定键值的系统设定值
public static void GetSystemValueByKey(string pSystemKey)
{
string strSQL = @"SELECT [SystemValue]
FROM [SystemSetting]
WHERE SystemKey=@SystemKey";
SqlParameter[] parms = new SqlParameter[1];
parms[0] = new SqlParameter("@SystemKey", SqlDbType.NVarChar, 20);
parms[0].Value = pSystemKey;
DBTools.CreateStoredProcedure(strSQL, parms);
}
[Microsoft.SqlServer.Server.SqlProcedure]
//删除所有系统设置值
public static void DeleteAllSetting()
{
string strSQL = @"DELETE FROM [SystemSetting];";
DBTools.CreateStoredProcedure(strSQL);
}
[Microsoft.SqlServer.Server.SqlProcedure]
//初始化系统
public static void Initialize()
{
string strSQL = @"DELETE FROM [SystemSetting];
DELETE FROM [UserInfo];
DELETE FROM [Role];
DELETE FROM [Activation];
DELETE FROM [Attachment];
DELETE FROM [Item];
DELETE FROM [Posts];
DELETE FROM [RoleItemMap];";
DBTools.CreateStoredProcedure(strSQL);
}
[Microsoft.SqlServer.Server.SqlProcedure]
//设置指定键值的系统设定值
public static void SetSystemValueByKey(string pSystemKey, string pSystemValue)
{
string strSQL = @"UPDATE [SystemSetting]
SET [SystemValue] = @SystemValue
WHERE SystemKey=@SystemKey";
SqlParameter[] parms = new SqlParameter[2];
parms[0] = new SqlParameter("@SystemValue", SqlDbType.NVarChar, 20);
parms[1] = new SqlParameter("@SystemKey", SqlDbType.NVarChar, 500);
parms[0].Value = pSystemKey;
parms[1].Value = pSystemValue;
DBTools.CreateStoredProcedure(strSQL, parms);
}
[Microsoft.SqlServer.Server.SqlProcedure]
//添加指定键值的系统设定值
public static void AddSystemValue(string pSystemKey, string pSystemValue)
{
string strSQL = @"INSERT INTO [LocaleBBS].[dbo].[SystemSetting]
([SystemKey],[SystemValue])
VALUES
(@SystemKey,@SystemValue)";
SqlParameter[] parms = new SqlParameter[2];
parms[0] = new SqlParameter("@SystemKey", SqlDbType.NVarChar, 20);
parms[1] = new SqlParameter("@SystemValue", SqlDbType.NVarChar, 500);
parms[0].Value = pSystemKey;
parms[1].Value = pSystemValue;
DBTools.CreateStoredProcedure(strSQL, parms);
}
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?