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 .OleDb ;
/// <summary>
/// Socut 的摘要说明
/// </summary>
public class Socut
{
private string SConnString;
public Socut()
{
SConnString = GetConnString();
}
protected static string GetConnString()
{
return (ConfigurationSettings .AppSettings [ "SocutConnectionString "]);
}
public OleDbConnection getcn()
{
OleDbConnection con=new OleDbConnection (SConnString );
return con;
}
public void GetExecuteNonQuery(string Query)
{
OleDbConnection cn=getcn ();
cn.Open ();
OleDbCommand SDbcommand=new OleDbCommand (Query ,cn);
SDbcommand .ExecuteNonQuery ();
}
public DataSet GetDataSet(string sql,int statindex,int num,string dataname)
{
OleDbConnection cn=getcn ();
cn.Open ();
OleDbCommand SDbcommand=new OleDbCommand (sql ,cn);
OleDbDataAdapter SDataAdapter=new OleDbDataAdapter (SDbcommand );
DataSet SDataSet=new DataSet ();
SDataAdapter .Fill (SDataSet ,statindex ,num ,dataname );
return SDataSet;
}
public OleDbDataReader Read(String sql)
{
OleDbConnection cn = getcn();
cn.Open();//错误,说ConnectionString 属性尚未初始化
OleDbCommand SDbcommand = new OleDbCommand(sql, cn);
return SDbcommand.ExecuteReader();