Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Conversion from type Conversion from type 'DBNull' to type 'Integer' is not valid
Previous
 
Next
New Post
8/24/2006 6:30 AM
 

Any idea why the below given error occurs ?

ExceptionGUID: b278179b-f7cc-46fd-bd16-4e12eeb99416
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
InnerException: Conversion from type 'DBNull' to type 'Integer' is not valid.
Message: DotNetNuke.Services.Exceptions.ModuleLoadException: Conversion from type 'DBNull' to type 'Integer' is not valid. ---> System.InvalidCastException: Conversion from type 'DBNull' to type 'Integer' is not valid. at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(Object Value) at MyWebsite.Modules.LTShare.SqlDataProvider.AddLTBooking(Int32 bookingID, Int32 tripID, String name, String contactNo, String address, Int32 seatsPurchased, Double amountTransacted, String receiptNo, DateTime bookingDate, String destination, String paymentMode, String counterID) in c:\inetpub\wwwroot\ MyWebsite\App_Code\LTShare\SqlDataProvider.vb:line 111 at MyWebsite.Modules.LTShare.LTBookingController.Add(LTBookingInfo objLTBooking) in c:\inetpub\wwwroot\MyWebsite\App_Code\LTShare\LTBookingController.vb:line 98 at DesktopModules_LTBookingGUI_counter.cmdUpdate_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\MyWebsite\DesktopModules\LTBookingGUI\counter.ascx.vb:line 50 --- End of inner exception stack trace ---
Actually, this happens on the statment, controllerObject.Add(InfoObject) (this is the line depicted above on line 50)which inserts a rows into a table. The insert is working fine, but ends with the general exception "A critical error has occured".

Please help me on this. Thanking you in advance

regards

Praveen

 

 
New Post
8/24/2006 8:19 AM
 

What this actually means is that a database null value is tried to be converted to integer.

Can you post your code here? (with stored procedure, if you use one)


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
New Post
8/24/2006 3:51 PM
 

I agree with Vladan, the code would be most helpful. What it boils down to is you are trying to convert a DBNull to an integer. Since this is happening post-update, I think your Info class may be getting a DBNull value from the database.

If you are using reflection ala DNN, then you could be failing on "bad" data. This again is happening when the DAL is trying to populate your Info class. Unfortunately DNN uses the FillObject from the CBO class. In this case you are going to have to make the offending fields required fields.

Using SQL Profiler, you can capture the stored procedure that is returning your data. Once you repeat the error find the get stored procedure and highlight it in SQL Profiler copy the line at the bottom and run it in Query Analyzer. The resulting rows returned will help you identify the offending record(s).


Cheers!
John Valentine
http://www.webinnovationsystems.com
 
New Post
8/25/2006 2:40 AM
 

By the procedure and the erorr I would say that you are not returning a return value from the procedure, and then an empty return as it is you are trying to CInt.

 


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
New Post
8/25/2006 3:07 AM
 

Thanks Vladan Strigo and HisKid for you very valuable replies......

The procedure in the controller file, was returning the integer value before. I changed the database structure, and thus there was nothing being returned from the function.

Now its working fine.....thanks again...

regards

Praveen

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Conversion from type Conversion from type 'DBNull' to type 'Integer' is not valid


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out