DBNULL...again
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


123»»»

DBNULL...againExpand / Collapse
Author
Message
Posted 05/04/2008 10:34:31 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:32:27 AM
Posts: 574, Visits: 4,617
Scenario:

I have inherited a table with two fields, one decimal, one string. These together represent the primary key. I need both fields on a maintenance form, bound to textboxes.

Display/Edit/Save is working. I cannot get a new record to add.

I get 'Conversion from type 'DBNull' to type 'String' is not valid.' on the line:

Return CType(Me.CurrentRow.Item("ITREPORT"), System.String) in the field properties. I tried to set the defaultValues and the first one sets fine, the second always gives the above error, regardless of the order set. I have PrimaryKeyIsAutoIncremented = False, PrimaryKeyIsUpdateable = True, and even tried out AllowNullsOnNewRow = True. The database fields (DB2) are set to not allow nulls, and have default values set.

I know this could be fixed easily by adding a proper autoincrement key column but I cant, the table is part of a legacy system and the customer is insistant it work as described above, frankly I'm not sure why it isnt. It works fine if the fields are unbound from the textboxes.

I must be missing somethign simple. Which is likely since I havent been coding much lately.

 

Post #16120
Posted 05/04/2008 10:39:11 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:32:27 AM
Posts: 574, Visits: 4,617
I should add I'm on 1.6.5
Post #16121
Posted 05/05/2008 3:18:01 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 5:25:17 PM
Posts: 211, Visits: 1,003
Hi Keith,

You could try "Return alternate.." in the BO mapper and set the alternate to "String.Empty".

Do you need to be able to store nulls in that column in database? We don't allow any database column to be nullable unless it is absolutely necessary.

Cheers, Peter

Post #16122
Posted 05/05/2008 7:26:59 AM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:32:27 AM
Posts: 574, Visits: 4,617
No, both columns are set to disallow NULL. I will try your suggestion now. Thanks.
Post #16124
Posted 05/05/2008 7:39:10 AM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:32:27 AM
Posts: 574, Visits: 4,617
Is that feature under "Customize" in the mapper? I cant find it elsewhere and for some reason "Customize" and "Clear" are greyed out and the customization wizard bombs out on me. 

NullReferenceException
  Object reference not set to an instance of an object.

Source     : MicroFour StrataFrame AddIns

Stack Trace:
   at MicroFour.StrataFrame.AddIns.DTEprojectsBO.FillProjects(String[] ProjectPaths)
   at MicroFour.StrataFrame.AddIns.PartialClassBuilderCustomizeWizard.ᜀ(ᜏ A_0)
   at MicroFour.StrataFrame.AddIns.PartialClassBuilderCustomizeWizard.ᜀ()
   at MicroFour.StrataFrame.AddIns.PartialClassBuilderCustomizeWizard.OnLoad(EventArgs e)

Post #16125
Posted 05/05/2008 7:56:06 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 9:46:15 PM
Posts: 288, Visits: 1,135
Keith Chisarik (05/05/2008)
Is that feature under "Customize" in the mapper? I cant find it elsewhere and for some reason "Customize" and "Clear" are greyed out and the customization wizard bombs out on me. 

Hi Keith,

In the BO Mapper, just double click the field you want to modify and on the right side of the Custom Field Properties, set the NULL  Value Option to "Return Alternate on Null" or any other that apply to your case.

Edhy Rijo
Progytech (Computer Consultants)
Post #16127
Posted 05/05/2008 8:18:40 AM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:32:27 AM
Posts: 574, Visits: 4,617
Thank you both, that worked!

I'll admit I am confused why that step was necessary, but I'll save that for another day, unless someone is feeling like enlightening

Post #16128
Posted 05/05/2008 8:42:40 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 9:46:15 PM
Posts: 288, Visits: 1,135
Keith Chisarik (05/05/2008)
I'll admit I am confused why that step was necessary, but I'll save that for another day, unless someone is feeling like enlightening

Well basically that step is there to allow you to handle your specific database Null values, so you can accommodate your SF project to be compatible with any DBNull schema used.  In your particular case you don't have access to modify the database the way you want it, but that will not stop your SF project to keep working.

Just my 0.02

Edhy Rijo
Progytech (Computer Consultants)
Post #16130