我写的三层 朋友们帮看看有啥毛病没
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
/// <summary>
/// Data 的摘要说明
/// </summary>
public class data
{
public data()
{
//构造函数
}
public string connection()
{
string connstr;
connstr = ConfigurationManager.AppSettings[ "databasestr "].ToString();
return connstr;
}
public DataSet proc_dataset(string sqlstr)
{
SqlConnection conn = new SqlConnection(connection());
DataSet dt = new DataSet();
try
{
SqlCommand cmd = new SqlCommand( "easyproc ", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter para;
para = cmd.Parameters.Add( "@csql ", SqlDbType.NVarChar, 3000);
cmd.Parameters[ "@csql "].Value = sqlstr;
para = cmd.Parameters.Add( "@total ", SqlDbType.Int);
para.Direction = ParameterDirection.Output;
para = cmd.Parameters.Add( "@retime ", SqlDbType.VarChar, 50);
para.Direction = ParameterDirection.Output;
SqlDataAdapter ada = new SqlDataAdapter(cmd);
ada.Fill(dt, "dt ");
conn.Close();