为什么没有处理int Result=100;
string area_code = Session["area_code"].ToString();
string userid=Session["userid"].ToString() ;
string connectionString = GetSection1("vehicleConnectionString");
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand com = new SqlCommand("sp_check_bank_bill", connection);
com.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = com.Parameters.Add("@area", SqlDbType.VarChar,10);
p1.Value = area_code;
SqlParameter p2 = com.Parameters.Add("@telecomm_account", SqlDbType.VarChar, 30);
p2.Value = telecomm_account.Text;
SqlParameter p3 = com.Parameters.Add("@bill_yearmonth", SqlDbType.VarChar, 20);
p3.Value = Bill_yearmonth.Text;
SqlParameter p4 = com.Parameters.Add("@employee", SqlDbType.VarChar, 20);
p4.Value = userid;
SqlParameter p5 = com.Parameters.Add("@pos_telecomm_account", SqlDbType.VarChar, 30);
p5.Value = Pos_account.Text;
connection.Open();
//SqlDataReader reader = com.ExecuteReader();
//if (reader.Read())
// Result = reader.GetInt16(0);
Result = com.ExecuteNonQuery();
}
switch (Result)
{
case 100:
Status.Text = "警告:存储过程调用异常,稽核处理没有执行!";
break;
case 0:
Status.Text="稽核处理完成!";
break;
case -1:
Status.Text = "警告:这个月份的账单已经归档,不能在处理了!";
break;
case -2:
Status.Text = "警告:银行账单中pos费用和pos账单中费用不匹配";
break; }返回值总是-1,表里面查询也没处理痕迹
string area_code = Session["area_code"].ToString();
string userid=Session["userid"].ToString() ;
string connectionString = GetSection1("vehicleConnectionString");
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand com = new SqlCommand("sp_check_bank_bill", connection);
com.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = com.Parameters.Add("@area", SqlDbType.VarChar,10);
p1.Value = area_code;
SqlParameter p2 = com.Parameters.Add("@telecomm_account", SqlDbType.VarChar, 30);
p2.Value = telecomm_account.Text;
SqlParameter p3 = com.Parameters.Add("@bill_yearmonth", SqlDbType.VarChar, 20);
p3.Value = Bill_yearmonth.Text;
SqlParameter p4 = com.Parameters.Add("@employee", SqlDbType.VarChar, 20);
p4.Value = userid;
SqlParameter p5 = com.Parameters.Add("@pos_telecomm_account", SqlDbType.VarChar, 30);
p5.Value = Pos_account.Text;
connection.Open();
//SqlDataReader reader = com.ExecuteReader();
//if (reader.Read())
// Result = reader.GetInt16(0);
Result = com.ExecuteNonQuery();
}
switch (Result)
{
case 100:
Status.Text = "警告:存储过程调用异常,稽核处理没有执行!";
break;
case 0:
Status.Text="稽核处理完成!";
break;
case -1:
Status.Text = "警告:这个月份的账单已经归档,不能在处理了!";
break;
case -2:
Status.Text = "警告:银行账单中pos费用和pos账单中费用不匹配";
break; }返回值总是-1,表里面查询也没处理痕迹
解决方案 »
- C#中zedgraph绘制的图中怎样显示文本和变量值
- C#调API创建窗口
- 求个SQL写法,谢谢各位~~~
- 随机读取Access数据记录的奇怪问题
- Winform windows.services的Timer怎么启用?
- ado.net 究竟如何支持 autotranslate 属性.?
- 如何把另一个应用程序的窗口集成到自己的程序的窗口上
- 如何實現像windows裡的文件搜索功能
- 在C#的combobox显示多个数据表名的问题
- 我的调试错误(请你看看)
- 为什么program.cs文件中会出现 "InvalidArgument= 0 的值对于 index 无效"的异常
- 请教数据库的操作,对两个表的操作?
是得到影响的行数,比如插入,删除,修改等,如果是查询则始终是-1;
用SqlDataAdapter获取数据集吧!
如果是的话,那就不是这么写的,不然偶也不知道你要干吗了SqlParameter a = theCommand2.Parameters.Add("@code", SqlDbType.VarChar, 15);
a.Direction = ParameterDirection.Output;
theConn.Open();
int i = theCommand2.ExecuteNonQuery();
theConn.Close();
return a.Value.ToString();上面的是获得输出参数的方法
int Result=100;
string area_code = Session["area_code"].ToString();
string userid=Session["userid"].ToString() ;
string connectionString = GetSection1("vehicleConnectionString");
using (SqlConnection connection = new SqlConnection(connectionString))
{
// SqlCommand com = new SqlCommand("sp_check_bank_bill", connection);
SqlCommand com = new SqlCommand("sp_check_bank_bill", connection);
com.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = com.Parameters.Add("@area", SqlDbType.VarChar, 10);
p1.Value = area_code;
SqlParameter p2 = com.Parameters.Add("@telecomm_account", SqlDbType.VarChar, 30);
p2.Value = telecomm_account.Text;
SqlParameter p3 = com.Parameters.Add("@bill_yearmonth", SqlDbType.VarChar, 20);
p3.Value = Bill_yearmonth.Text;
SqlParameter p4 = com.Parameters.Add("@employee", SqlDbType.VarChar, 20);
p4.Value = userid;
SqlParameter p5 = com.Parameters.Add("@pos_telecomm_account", SqlDbType.VarChar, 30);
p5.Value = Pos_account.Text;
p1.Direction = ParameterDirection.Input;
p2.Direction = ParameterDirection.Input;
p3.Direction = ParameterDirection.Input;
p4.Direction = ParameterDirection.Input;
p5.Direction = ParameterDirection.Input;
SqlParameter p_out = com.Parameters.Add("@RETURN_VALUE", SqlDbType.Int, 1);
p_out.Direction = ParameterDirection.ReturnValue;
connection.Open();
//SqlDataReader reader = com.ExecuteReader();
//if (reader.Read())
// Result = reader.GetInt16(0);
com.CommandTimeout = 3000;
com.ExecuteNonQuery();
Result = (int)p_out.Value;
}
switch (Result)
{
case 100:
Status.Text = "警告:存储过程调用异常,稽核处理没有执行!";
break;
case 0:
Status.Text="稽核处理完成!";
break;
case -1:
Status.Text = "警告:这个月份的账单已经归档,不能在处理了!";
break;
case -2:
Status.Text = "警告:银行账单中pos费用和pos账单中费用不匹配";
break;
case -3:
Status.Text = "警告:没有这个月份的账单!";
break;
}