using System.Web;

using System.Data.SqlClient;

using System.Configuration;

using System.Net.Mail;

using System.Data;

 

///<summary>

/// csCommand 的摘要描述

///</summary>

public class csCommand : IDisposable

{

   public csCommand()

   {

   }

 

   public csCommand(SqlConnection tConn, string tCommandText)

   {

       m_Comm.CommandText = tCommandText;

        m_Comm.Connection = tConn;

       m_Comm.Connection.Open();

   }

 

   SqlCommand m_Comm = new SqlCommand() { CommandType = System.Data.CommandType.StoredProcedure };

   public SqlCommand Comm

   {

       get { return m_Comm; }

       set { m_Comm = value; }

   }

 

   SqlDataAdapter m_Adap = new SqlDataAdapter();

   public SqlDataAdapter Adap

   {

       get { return m_Adap; }

       set { m_Adap = new SqlDataAdapter() { SelectCommand = m_Comm }; }

   }

 

   public string ExecuteNonQuery()

   {

       m_Comm.ExecuteNonQuery();

       return (m_Comm.Parameters["@Return"].Value.ToString());

   }

 

   public void Dispose()

   {

       if (m_Comm.Connection.State == System.Data.ConnectionState.Open)

       {

           m_Comm.Connection.Close();

       }

       m_Comm.Dispose();

       m_Adap.Dispose();

   }

}

 


arrow
arrow

    倧齊 發表在 痞客邦 留言(0) 人氣()