缺少指令或汇编参考

时间:2018-07-18 16:33:25

标签: asp.net asp.net-mvc web-services wcf

我需要检查用户是否选择更改消息,因为我需要通过传递ID来获取会员的状态和日期。我越来越缺少程序集引用或指令。我收到错误消息,因为SmsStatusResult不包含状态定义。

型号:

public class SmsStatus
{
   public string Status { get; set; }
   public DateTime OptInDate { get; set; }
} 


public class SmsStatusResult : OperationResult
{
    public SmsStatus SmsStatus { get; set; }
}

方法:

public static SmsStatusResult GetSmsStatus(string memberNumber)
{
   // string Status = string.Empty, OptInDate = string.Empty;
    var Status = "";
    var OptInDate = "";


    var smsStatusResult = new SmsStatusResult();

    if (!string.IsNullOrEmpty(memberNumber))
    {
        using (
            var connection =
                new OracleConnection(
                    ConfigurationManager.ConnectionStrings["OracleMemberConnectionString"].ConnectionString))
        {
            connection.Open();

            using (
                var command =
                    new OracleCommand(
                        "SELECT sms_status,sms_opt_in_date FROM member WHERE member_nbr = :memberNumber", connection))
            {
                command.Parameters.Add(
                    new OracleParameter(
                        "memberNumber",
                        OracleDbType.Varchar2,
                        memberNumber,
                        ParameterDirection.Input));


                SmsStatusResult data;
                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        data = new SmsStatusResult(); 
                        data.Status = reader["sms_status"].ToString(); //SmsStatusResult does not contain definition for status. missing a using directive or assembly reference
                        data.OptInDate = reader["sms_opt_in_date"].ToString(); SmsStatusResult does not contain definition for OptInDate . missing a using directive or assembly reference

                        break;
                    }
                     return data;
                }

            }
        }
    }

0 个答案:

没有答案