////// exec proceudre2
//System.Data.SqlClient.SqlConnection sqlcon = new System.Data.SqlClient.SqlConnection("server=(local);database=pubs;uid=sa;pwd=;");
System.Data.SqlClient.SqlConnection sqlcon = new System.Data.SqlClient.SqlConnection(@"Data Source=192.168.1.8\mis;Initial Catalog=erp;User ID=sa;Password=3860;");
System.Data.SqlClient.SqlCommand sqlcmd = new System.Data.SqlClient.SqlCommand("pSCRBCDCONFORM", sqlcon);
sqlcmd.CommandType = System.Data.CommandType.StoredProcedure;
//添加存储过程输入输出参数类型及输入参数值
sqlcmd.Parameters.Add("@DH", System.Data.SqlDbType.VarChar, 50).Value = str_DH;
sqlcmd.Parameters.Add("@CONFORM_CODE", System.Data.SqlDbType.VarChar, 50).Value = "Y";
sqlcmd.Parameters.Add("@CONFORM_Name", System.Data.SqlDbType.VarChar, 50).Value = "BPM流程审核";
sqlcmd.Parameters.Add("@CONFORM_Date", System.Data.SqlDbType.VarChar, 50).Value = str_FinishDate.Trim();
sqlcmd.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int, 4).Value = "-1";
//指定参数类型是输入参数还是输出参数
sqlcmd.Parameters["@DH"].Direction = System.Data.ParameterDirection.Input;
sqlcmd.Parameters["@CONFORM_CODE"].Direction = System.Data.ParameterDirection.Input;
sqlcmd.Parameters["@CONFORM_Name"].Direction = System.Data.ParameterDirection.Input;
sqlcmd.Parameters["@CONFORM_Date"].Direction = System.Data.ParameterDirection.Input;
sqlcmd.Parameters["@ReturnValue"].Direction = System.Data.ParameterDirection.ReturnValue;
//sqlcmd.Parameters.Add("@rus", System.Data.SqlDbType.Int);
//sqlcmd.Parameters.Add("@outrus", System.Data.SqlDbType.Int);
//sqlcmd.Parameters[0].Direction = System.Data.ParameterDirection.ReturnValue;
//sqlcmd.Parameters[1].Direction = System.Data.ParameterDirection.Output;
sqlcon.Open();
//int res=(int)sqlcmd.ExecuteNonQuery();//此时返回的不是存储过程的返回值,以上只是返回delete,update,insert所影响的行数
//接受执行存储过程后的返回值
//int n = System.Convert.ToInt32(sqlcmd.Parameters["@ReturnValue"].Value); ------me-----
sqlcmd.ExecuteNonQuery();
//string res = sqlcmd.Parameters[0].Value.ToString();//这样就可以得到存储过程的返回值
sqlcon.Close();
//