using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;public partial class Receive : System.Web.UI.Page
{
protected string v_oid; // 订单号
protected string v_pstatus; // 支付状态码
//20(支付成功,对使用实时银行卡进行扣款的订单);
//30(支付失败,对使用实时银行卡进行扣款的订单); protected string v_pstring; //支付状态描述
protected string v_pmode; //支付银行
protected string v_amount; //支付金额
protected string v_moneytype; //币种
protected string re1; // 备注1
protected string re2; // 备注1
protected string v_md5str;
protected string status_msg;
protected string str; // 备注1
protected void Page_Load(object sender, EventArgs e)
{
// MD5密钥要跟订单提交页相同,如Send.asp里的 key = "test" ,修改""号内 test 为您的密钥
string key = "13880604309171471"; // 如果您还没有设置MD5密钥请登陆我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/
// 登陆后在上面的导航栏里可能找到“B2C”,在二级导航栏里有“MD5密钥设置”
// 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了 v_oid = Session["Accounts"].ToString();
v_pstatus = Request["v_pstatus"];
v_pstring = Request["v_pstring"];
v_pmode = Request["v_pmode"];
v_md5str = Request["v_md5str"];
v_amount = Session["amount"].ToString();
v_moneytype = Request["v_moneytype"];
re1 = Request["re1"];
re2 = Request["re2"]; string str = v_oid + v_pstatus + v_amount + v_moneytype + key; str = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "md5").ToUpper(); if (str == v_md5str)
{ if (v_pstatus.Equals("20"))
{
int UserID = 0;
string name = v_oid;
int amount =Convert.ToInt32(v_amount);//报错说输入格式不正确
SqlConnection con = DBL.DBhelper.getConnection();
con.Open();
SqlCommand cmd = new SqlCommand("select UserID from AccountsInfo where Accounts='" + name + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
if(dr.Read())
{
UserID = int.Parse(dr[0].ToString());
}
con.Close();
SQLServerDAL.DAlScore.InsertGamecong(UserID, amount);
int Score = SQLServerDAL.DAlScore.SelectScore(UserID);
int Score1 = (amount * 1000) + Score;
SQLServerDAL.DAlScore.UpScore(UserID, Score1);
}
}
else
{
status_msg="校验失败,数据可疑" ;
}
}
}int amount =Convert.ToInt32(v_amount);//报错说输入格式不正确
解决方案 »
- 控件GridView中的问题
- 虚拟目录需要验证访问,如何配置某个ASPX页面匿名访问?
- 这一句程序是什么意思,请帮忙解释一下
- 麻烦大家看一下!
- private void BindGrid()什么意思,请说明详细点,谢谢!
- 问个关闭窗口的问题
- 关于孟子的“Repeater控件显示主-从关系数据表”修改问题,大虾帮忙??
- ★★★送分快来抢★★★:现在有wpf(Windows Presentation Foundation)的中文书卖吗?
- 请问大家建网站时会不会先用UML建模啊?如果用,一般用什么工具?
- 发生HTTP错误403。(开始执行,不调试时)!!
- MYSQL update 语句问题
- 哪有可以插入程序源代码的在线编辑器?
你可以debug看下从Session中抓出的v_amount是什么? 正常吗?
还0.01,明明知道钱有角分的撒。- -
int amount =Convert.ToInt32(v_amount);//报错说输入格式不正确改为float类型
改成:
double amount = Convert.ToDouble(v_amount);int Score1 = (amount * 1000) + Score;
改成:
int Score1 +=(int)((amount * 1000) + Score);