?? depsch.cs
字號:
using System;
using System.Data;
using System.Data.SqlClient;
namespace qminoa.DA
{
/// <summary>
/// depsch 的摘要說明。
/// </summary>
public class depsch
{
private String conn=System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString");
private SqlDataAdapter objadapter = new SqlDataAdapter();
private SqlCommand objcommand;
//不能定義為共有變量
// private DataTable objdataset = new DataTable();
public depsch()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
public DataTable cpdepempread(string Branch,string Dep,string EmpName)
{
return reading("cpDepEmpRead","@Branch",Branch,"@Dep",Dep,"@EmpName",EmpName);
}
public DataTable reading(string commandText, string paramName1, string paramValue1,string paramName2, string paramValue2,string paramName3,string paramValue3)
{
if (objadapter == null)//異常處理
{
throw new System.ObjectDisposedException( GetType().FullName );
}
//不能定義為共有變量
DataTable objdataset = new DataTable();
objadapter.SelectCommand = new SqlCommand();
objadapter.SelectCommand.Connection = new SqlConnection(conn);
objcommand = objadapter.SelectCommand;
objcommand.CommandText = commandText;
objcommand.CommandType = CommandType.StoredProcedure;
objcommand.Parameters.Add(new SqlParameter(paramName1, SqlDbType.VarChar));
objcommand.Parameters[paramName1].Value=paramValue1;
objcommand.Parameters.Add(new SqlParameter(paramName2, SqlDbType.VarChar));
objcommand.Parameters[paramName2].Value=paramValue2;
objcommand.Parameters.Add(new SqlParameter(paramName3, SqlDbType.VarChar));
objcommand.Parameters[paramName3].Value=paramValue3;
objadapter.Fill(objdataset);
return objdataset;
}
public DataTable cpdepschread(DateTime paramValue1,int paramValue2)
{
return reading("cpDepSchRead","@Fdate",paramValue1,"@EmpID",paramValue2);
}
public DataTable reading(string commandText, string paramName1, DateTime paramValue1,string paramName2,int paramValue2)
{
if (objadapter == null)//異常處理
{
throw new System.ObjectDisposedException( GetType().FullName );
}
//不能定義為共有變量
DataTable objdataset = new DataTable();
objadapter.SelectCommand = new SqlCommand();
objadapter.SelectCommand.Connection = new SqlConnection(conn);
objcommand = objadapter.SelectCommand;
objcommand.CommandText = commandText;
objcommand.CommandType = CommandType.StoredProcedure;
objcommand.Parameters.Add(new SqlParameter(paramName1, SqlDbType.DateTime));
objcommand.Parameters[paramName1].Value=paramValue1;
objcommand.Parameters.Add(new SqlParameter(paramName2, SqlDbType.Int));
objcommand.Parameters[paramName2].Value=paramValue2;
objadapter.Fill(objdataset);
return objdataset;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -