using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
/// <summary>
///BBSManager 的摘要说明
/// </summary>
public class BBSManager
{
public BBSManager()
{
}
/// <summary>
///添加论坛的类别
/// </summary>
/// <param name="name">类别名称</param>
/// <param name="des">类别描述信息</param>
///<returns>添加是否成功</returns>
public bool AddBBSCategory(string name, string des)
{
StringBuilder strSQL = new StringBuilder();
SqlParameter[] newsParms =new SqlParameter[] {
new SqlParameter("@name", SqlDbType.NVarChar,50),
new SqlParameter("@des", SqlDbType.NVarChar,100)};
SqlCommand cmd = new SqlCommand();
newsParms[0].Value = name;
newsParms[1].Value = des;
foreach (SqlParameter parm in newsParms)
cmd.Parameters.Add(parm);
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
strSQL.Append("Insert into BBSCategory values(@name, @des)");
conn.Open();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = strSQL.ToString();
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
if (val>0)
return true;
else
return false;
}
}
}
拉莫斯之舞
ibeautiful