الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Error:cast From Type 'dbnull' To Type 'integer' Is Not Valid.

بدأه firas momtaz في 26 يوليو 2008 · 1 رد · 471 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

لقد قمت بتغيير جهاز الكمبيوتر فظهر هذا error

Cast from type 'DBNull' to type 'Integer' is not valid.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Cast from type 'DBNull' to type 'Integer' is not valid.

Source Error:

Line 57: Dim myresult As VoteResult = New VoteResult()Line 58: myresult.votevgood = parametervgood.ValueLine 59: myresult.votegood = parametergood.ValueLine 60: myresult.votebad = parameterbad.ValueLine 61: myresult.total = parametertotal.Value

Source File: C:\Backup\7-5-04\WebApplication4\Classes\Account.vb Line: 59

Stack Trace:

[invalidCastException: Cast from type 'DBNull' to type 'Integer' is not valid.] Microsoft.VisualBasic.CompilerServices.IntegerType.FromObject(Object Value) +819 WebApplication4.Mall.voteDB.voteresult() in C:\Backup\7-5-04\WebApplication4\Classes\Account.vb:59 WebApplication4._Default.myresult() in C:\Backup\7-5-04\WebApplication4\Default.aspx.vb:94 WebApplication4._Default.submit1_Click(Object sender, EventArgs e) in C:\Backup\7-5-04\WebApplication4\Default.aspx.vb:80 System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +108 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePo

stBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138 System.Web.UI.Page.ProcessRequestMain() +1292ارجو المساعده لحل هذه المشكله

#2

البيان الموجود في قاعدة البيانات خالي NULL وعندما تستدعيه فأنت تحاول تحويل هذه الخانة إلى Integer وهذا ما يسبب الخطأ إذ Integer لا تقبل أن تكون NULL

ASP.NET Team Leader

moh_kin_mah@hotmail.com

--------------------------------

لو أعجبك أي من مشاركاتي ... برجاء قم بتقييم المشاركة عبر الأزرار الموجودة أسفل يسار كل مشاركة

مواضيع مشابهة