“TransactionCompName”名称在当前上下文中不存在

时间:2015-08-12 06:31:47

标签: asp.net sql-server c#-4.0 ado.net

string TransactionCustName = HttpContext.Current.Session["TransCust_Name"].ToString();
string CustEmail = HttpContext.Current.Session["EmailId"].ToString();


using (SqlConnection conn = new SqlConnection(sqlconn))
{
    conn.Open();
    string query = "PayTransaction";
    using (SqlCommand com = new SqlCommand(query, conn))
    {
        com.CommandType = CommandType.StoredProcedure;
        com.Parameters.AddWithValue("@TranRef", BankMerchantRef); //com.Parameters.AddWithValue("@TranRef", Dr_TransactionReference);
        //com.Parameters.AddWithValue("@TimeDate", DateTime.Now);
        com.Parameters.AddWithValue("@TranMerchRef", BankMerchRef); //com.Parameters.AddWithValue("@TranMerchRef", Dr_MerchantReference);
        com.Parameters.AddWithValue("@TranAmt", Bank_AmtPaid);  //com.Parameters.AddWithValue("@TranAmt", Dr_BankAmtPaid);
        com.Parameters.AddWithValue("@TranResultCode", Bank_ResponseCode); //com.Parameters.AddWithValue("@TranResultCode", Dr_ResponseCode);
        com.Parameters.AddWithValue("@TranStatus", Bank_TransDesc); //com.Parameters.AddWithValue("@TranStatus ", Dr_TransactionDesc);
        com.Parameters.AddWithValue("@TranRecptNo", Bank_ReceiptN0); // com.Parameters.AddWithValue("@TranRecptNo", Dr_ReceiptNo);
        com.Parameters.AddWithValue("@TranAuthCode", Bank_Authorize_ID); // com.Parameters.AddWithValue("@TranAuthCode", Dr_AuthorizeId);
        com.Parameters.AddWithValue("@TranCardName", Bank_CardType); // com.Parameters.AddWithValue("@TranCardName", Dr_CardType);
        com.Parameters.AddWithValue("@BankStatus", Bank_Message);

        com.Parameters.AddWithValue("@TranCustName", TransactionCustName);
       // string Dr_CompName = "";
       // HttpContext.Current.Session["TashCustName"] = Dr_CompName;
        string Dr_Oracle_CustNo = "2140";  //2140
        com.Parameters.AddWithValue("@TranCompName", TransactionCompName);
        //com.Parameters.AddWithValue("@TranCompName", Dr_CompName);
        com.Parameters.AddWithValue("@TranEmail", CustEmail);
        com.Parameters.AddWithValue("@TranOraCustID",Dr_Oracle_CustNo);
        com.ExecuteNonQuery();
    }
}

在上面的代码中,我想将值TransactionCompName传递给数据库。但它给出了上述错误。我也会分享商店程序。

0 个答案:

没有答案