System.Data.SqlClient.SqlConnection sqlSvrDbCnt = new System.Data.SqlClient.SqlConnection(); //数据库连接对象
System.Data.SqlClient.SqlDataAdapter sqlSvrDbAdp = null; //数据适配器对象
System.Data.SqlClient.SqlCommand sqlSvrDbCmd = null; //数据命令处理对象
System.Data.SqlClient.SqlDataReader sqlSvrDbReader = null; //只进读取器对象
sqlSvrDbCnt.ConnectionString = "Data Source=LANDSEA-8CC1455//SQLEXPRESS;Initial Catalog=master;Integrated Security=True";
string sProcName = "p_test";
sqlSvrDbCmd = new System.Data.SqlClient.SqlCommand(); //建立数据命令对象的
sqlSvrDbCnt.Open(); //打开数据库连接
string sErrMessage = "";
try
{
sqlSvrDbCmd = new System.Data.SqlClient.SqlCommand(sProcName, sqlSvrDbCnt);//实例化命令对象
sqlSvrDbCmd.CommandType = CommandType.StoredProcedure;
//赋参数值
/*
sampParm = sampleCMD.Parameters.Add("@InputParm", SqlDbType.NVarChar, 12);
sampParm.Value = "Sample Value";
sampParm = sampleCMD.Parameters.Add("@OutputParm", SqlDbType.NVarChar, 28);
sampParm.Direction = ParameterDirection.Output;
*/
System.Data.SqlClient.SqlParameter sampParm = null;
sampParm = sqlSvrDbCmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int);
sampParm.Direction = ParameterDirection.ReturnValue;
sqlSvrDbCmd.Parameters.Add("@REPORTYEAR", SqlDbType.Int).Value = year;
sqlSvrDbCmd.Parameters.Add("@REPORTMONTH