Logo 
Search:

C# Forum

Ask Question   UnAnswered
Home » Forum » C#       RSS Feeds

Cannot unbox "dr["MemberId"]" as "Long"

  Asked By: Taru    Date: Dec 25    Category: C#    Views: 3169
  

Inside data access layer of my application i am declaring object as under


MemberProfileId = (Int64)(toReturn.Rows[0]["MP_MemberProfileId"]);


Above code is throwing an error:

Cannot unbox 'toReturn.Rows[0]["MP_MemberProfileId"]' as a 'long' System.Data.SqlTypes.SqlInt64


Can someone please help?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Shruti Sharma     Answered On: Dec 25

You can declare your code as below to avoid error


_mp_MemberProfileId = Convert.ToInt64(toReturn.Rows[0]["MP_MemberProfileId"])

 
Didn't find what you were looking for? Find more on Cannot unbox "dr["MemberId"]" as "Long" Or get search suggestion and latest updates.
This post is locked for further answers.




Tagged: