if (!IsPostBack)
{
try
{
Label1.Text = Session["user.transaction.id"].ToString(); //Error Line
}
catch (Exception a8)
{
Label1.Text = a8.Message;
}
}
我用来将信息存储到 Session 中的代码
尝试 {
_conn = new OdbcConnection(DatabaseManager.getConnectionString());
if (_conn.State == ConnectionState.Closed)
_conn.Open();
OdbcCommand cmd = _conn.CreateCommand();
cmd.CommandText = "{call vam_gen_new_card3(?,?,?,?,?,?,?,?,?,?,?)}";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@personal_card", OdbcType.Char, 1).Value = 'Y';
cmd.Parameters.Add("@holder_surname", OdbcType.VarChar, 50).Value = tbSurname.Text.ToString();
cmd.Parameters.Add("@holder_name", OdbcType.VarChar, 100).Value = tbName.Text.ToString();
cmd.Parameters.Add("@holder_cname", OdbcType.Char, 10).Value = tbCname.Text.ToString();
cmd.Parameters.Add("@date_of_birth", OdbcType.VarChar, 11).Value = tbDOB.Text.ToString();
cmd.Parameters.Add("@travel_document_no", OdbcType.VarChar, 20).Value = tbTravelDocNo.Text.ToString();
cmd.Parameters.Add("@nationality", OdbcType.VarChar, 40).Value = tbNationality.Text.ToString();
cmd.Parameters.Add("@email", OdbcType.VarChar, 50).Value = tbEmail.Text.ToString();
cmd.Parameters.Add("@telephone", OdbcType.VarChar, 20).Value = tbTelephone.Text.ToString();
cmd.Parameters.Add("@mobilephone", OdbcType.VarChar, 20).Value = tbMobile.Text.ToString();
cmd.Parameters.Add("@card_remark", OdbcType.VarChar, 255).Value = card_remark;
OdbcDataReader rs = cmd.ExecuteReader();
while (rs.Read())
{
Session["user.transaction.id"] = "SVC0" + rs["card_no"].ToString(); //get the transaction no.
Session["user.total_amount"] = Convert.ToDecimal(tbAmount.Text);
}
我最初在Session["user.transaction.id]
. 但是当我将信息发布到支付网关并回发时。我无法找回Session["user.transaction.id"]
并得到错误。我想知道如何解决这个问题。