Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 用户代码未处理无效的强制转换异常_Asp.net_Exception - Fatal编程技术网

Asp.net 用户代码未处理无效的强制转换异常

Asp.net 用户代码未处理无效的强制转换异常,asp.net,exception,Asp.net,Exception,对于上面的.net代码,我得到了异常,即用户代码未处理无效的强制转换异常。 但所有值都是精确的数据类型,即st.ClientID和ClientID分别为varchar50和string,AppId、AppId为longint IsDeleted为bit,那么错误原因是什么?如果有任何疑问,我希望发送详细信息,请对此提出建议。 多谢各位 [全局::System.Data.Linq.Mapping.TableAttributeName=dbo.ClientApp\u详细信息] 公共部分类客户端应用程

对于上面的.net代码,我得到了异常,即用户代码未处理无效的强制转换异常。 但所有值都是精确的数据类型,即st.ClientID和ClientID分别为varchar50和string,AppId、AppId为longint IsDeleted为bit,那么错误原因是什么?如果有任何疑问,我希望发送详细信息,请对此提出建议。 多谢各位

[全局::System.Data.Linq.Mapping.TableAttributeName=dbo.ClientApp\u详细信息] 公共部分类客户端应用程序详细信息:INotifyPropertyChanged,INotifyPropertyChanged {


st.IsDeleted应该是bool,我想。AppId,AppId是longint-那么转换为Int64的原因是什么?转换后我只提到了long int。我无法解决问题。请帮助我解决问题。请回复此问题。
public ClientApp_Detail GetHomeDetbyClientID_AppID(string clientid, long appId)
    {
        ClientApp_Detail sp = null;
        using (HelpDeskDataContext HDDC = Conn.GetContext())
        {
           sp = (from st in HDDC.ClientApp_Details where  st.ClientID == clientid && st.AppID == Convert.ToInt64(appId) && st.IsDeleted != 1 select st).FirstOrDefault();
        }
        return sp;
    }
    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

    private string _ClientID;

    private long _AppID;

    private string _ProjectScope;

    private string _ProjectStatus;

    private System.DateTime _StrDt;

    private System.DateTime _EndDt;

    private double _NoofHours;

    private long _ID;

    private System.Data.Linq.Binary _TimeStamp;

    //sumanth edit
    private bool _IsDeleted;


    private System.Nullable<System.DateTime> _CreationDt;

#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnClientIDChanging(string value);
partial void OnClientIDChanged();
partial void OnAppIDChanging(long value);
partial void OnAppIDChanged();
partial void OnProjectScopeChanging(string value);
partial void OnProjectScopeChanged();
partial void OnProjectStatusChanging(string value);
partial void OnProjectStatusChanged();
partial void OnStrDtChanging(System.DateTime value);
partial void OnStrDtChanged();
partial void OnEndDtChanging(System.DateTime value);
partial void OnEndDtChanged();
partial void OnNoofHoursChanging(double value);
partial void OnNoofHoursChanged();
partial void OnIDChanging(long value);
partial void OnIDChanged();
partial void OnTimeStampChanging(System.Data.Linq.Binary value);
partial void OnTimeStampChanged();
partial void OnIsDeletedChanging(bool value);
partial void OnIsDeletedChanged();
partial void OnCreationDtChanging(System.Nullable<System.DateTime> value);
partial void OnCreationDtChanged();
#endregion

    public ClientApp_Detail()
    {
        OnCreated();
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientID", DbType="VarChar(50) NOT NULL", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
    public string ClientID
    {
        get
        {
            return this._ClientID;
        }
        set
        {
            if ((this._ClientID != value))
            {
                this.OnClientIDChanging(value);
                this.SendPropertyChanging();
                this._ClientID = value;
                this.SendPropertyChanged("ClientID");
                this.OnClientIDChanged();
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AppID", DbType="BigInt NOT NULL", UpdateCheck=UpdateCheck.Never)]
    public long AppID
    {
        get
        {
            return this._AppID;
        }
        set
        {
            if ((this._AppID != value))
            {
                this.OnAppIDChanging(value);
                this.SendPropertyChanging();
                this._AppID = value;
                this.SendPropertyChanged("AppID");
                this.OnAppIDChanged();
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectScope", DbType="Text", UpdateCheck=UpdateCheck.Never)]
    public string ProjectScope
    {
        get
        {
            return this._ProjectScope;
        }
        set
        {
            if ((this._ProjectScope != value))
            {
                this.OnProjectScopeChanging(value);
                this.SendPropertyChanging();
                this._ProjectScope = value;
                this.SendPropertyChanged("ProjectScope");
                this.OnProjectScopeChanged();
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectStatus", DbType="Text", UpdateCheck=UpdateCheck.Never)]
    public string ProjectStatus
    {
        get
        {
            return this._ProjectStatus;
        }
        set
        {
            if ((this._ProjectStatus != value))
            {
                this.OnProjectStatusChanging(value);
                this.SendPropertyChanging();
                this._ProjectStatus = value;
                this.SendPropertyChanged("ProjectStatus");
                this.OnProjectStatusChanged();
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StrDt", DbType="DateTime NOT NULL", UpdateCheck=UpdateCheck.Never)]
    public System.DateTime StrDt
    {
        get
        {
            return this._StrDt;
        }
        set
        {
            if ((this._StrDt != value))
            {
                this.OnStrDtChanging(value);
                this.SendPropertyChanging();
                this._StrDt = value;
                this.SendPropertyChanged("StrDt");
                this.OnStrDtChanged();
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDt", DbType="DateTime NOT NULL", UpdateCheck=UpdateCheck.Never)]
    public System.DateTime EndDt
    {
        get
        {
            return this._EndDt;
        }
        set
        {
            if ((this._EndDt != value))
            {
                this.OnEndDtChanging(value);
                this.SendPropertyChanging();
                this._EndDt = value;
                this.SendPropertyChanged("EndDt");
                this.OnEndDtChanged();
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_NoofHours", DbType="Float NOT NULL", UpdateCheck=UpdateCheck.Never)]
    public double NoofHours
    {
        get
        {
            return this._NoofHours;
        }
        set
        {
            if ((this._NoofHours != value))
            {
                this.OnNoofHoursChanging(value);
                this.SendPropertyChanging();
                this._NoofHours = value;
                this.SendPropertyChanged("NoofHours");
                this.OnNoofHoursChanged();
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="BigInt NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true, UpdateCheck=UpdateCheck.Never)]
    public long ID
    {
        get
        {
            return this._ID;
        }
        set
        {
            if ((this._ID != value))
            {
                this.OnIDChanging(value);
                this.SendPropertyChanging();
                this._ID = value;
                this.SendPropertyChanged("ID");
                this.OnIDChanged();
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TimeStamp", AutoSync=AutoSync.Always, DbType="rowversion NOT NULL", CanBeNull=false, IsDbGenerated=true, IsVersion=true, UpdateCheck=UpdateCheck.Never)]
    public System.Data.Linq.Binary TimeStamp
    {
        get
        {
            return this._TimeStamp;
        }
        set
        {
            if ((this._TimeStamp != value))
            {
                this.OnTimeStampChanging(value);
                this.SendPropertyChanging();
                this._TimeStamp = value;
                this.SendPropertyChanged("TimeStamp");
                this.OnTimeStampChanged();
            }
        }
    }

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsDeleted", DbType="Bit NOT NULL", UpdateCheck=UpdateCheck.Never)]
    public bool IsDeleted
    {
        get
        {
            return this._IsDeleted;
        }
        set
        {
            if ((this._IsDeleted != value))
            {
                this.OnIsDeletedChanging(value);
                this.SendPropertyChanging();
                this._IsDeleted = value;
                this.SendPropertyChanged("IsDeleted");
                this.OnIsDeletedChanged();
            }
        }
    }