/// Produce 的摘要说明,下面实例

public class DbAccess { SqlConnection conn = null,cmd = new SqlCommand(),/summary&gt,/// Produce 的摘要说明,虽然我只是做,用c

public class DbAccess { SqlConnection conn = null; SqlCommand cmd =
null; public DbAccess() { // // TODO: 在此处添加构造函数逻辑 // conn =
new SqlConnection(); conn.ConnectionString =
Convert.ToString(System.Configuration.ConfigurationSettings.AppSettings[datasource]);
//conn.ConnectionString = initial catalog=_new;data source=.;user
id=bt;password=btbtbtbt;Connect Timeout=5000; cmd = new SqlCommand();
cmd.Connection = conn; cmd.CommandTimeout = 0; } public DbAccess(string
constr) { // // TODO: 在此处添加构造函数逻辑 // co

    public void Update(Int32 id, string name, string banji)
    {
        cmd.CommandText = “testUpdate”;
        cmd.CommandType = CommandType.StoredProcedure;

else
{
conn = sqlConn;

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.SqlClient;using
System.Text;using System.Collections;namespace mySqlSQLDB{

原文发布时间为:2008-08-02 —— 来源于本人的百度文章 [由搬家工具导入]

return udiDataBase(DeleteString,
SqlConn);
}
/// < summary>
/// 把数据插入数据库
/// < /summary>
/// < param
name=”InsertString”>Insert Sql语句< /param>
/// < param
name=”SqlConn”>数据库连接< /param>
/// < returns>插入成功返回true<
/returns>
public bool Insert(string InsertString,
SqlConnection SqlConn)
{

        cmd.Connection = conn;
        conn.Open();
        cmd.EndExecuteNonQuery();
        conn.Close();
    }
    public void Delete(Int32 id)
    {
        cmd.CommandText = “testDelete”;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue(“@Original_id”, id);
        cmd.Connection = conn;

}

        cmd.Parameters.AddWithValue(“@id”, id);
        cmd.Parameters.AddWithValue(“@name”, name);
        cmd.Parameters.AddWithValue(“@class”, banji);
        cmd.Parameters.AddWithValue(“@Original_id”, id);

conn.Close();
}

/// <summary>
/// Produce 的摘要说明
/// </summary>
public class Produce
{
    private SqlConnection conn;
    private SqlCommand cmd;
    private SqlDataAdapter sda;
    private DataSet ds;

else
{
conn = SqlConn;

    public Produce()
{
        conn = new
SqlConnection(ConfigurationManager.ConnectionStrings[“testConn”].ConnectionString);
        cmd = new SqlCommand();
        sda = new SqlDataAdapter();
        ds = new DataSet();     
}

conn.Open();
}
SqlDataAdapter mySqlDataAdapter = new
SqlDataAdapter();
SqlCommand selectCommand = new
SqlCommand(SelectString, conn);
selectCommand.CommandType =
CommandType.Text;
mySqlDataAdapter.SelectCommand =
selectCommand;
DataSet myDS = new DataSet();
mySqlDataAdapter.Fill(myDS);
return myDS;

    public DataTable dt()
    {
        sda.SelectCommand = new SqlCommand(“testSelect”);
        sda.SelectCommand.CommandType=CommandType.StoredProcedure;
        sda.Fill(ds,”test”);
        return ds.Tables[“test”];
    }

if (SqlConn == null)

        conn.Open();
        cmd.EndExecuteNonQuery();
        conn.Close();
    }

catch (Exception e)

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;

catch (Exception e)

}

strError = “”;

using System.Data.SqlClient;

}
}
}
}

}

finally
{
if (conn.State !=
ConnectionState.Closed)
{