Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DBnull error please help

jtmuzixjtmuzix Member Posts: 15
First let me make myself clear and say that Im not asking you to debug any code. Im using VS Studio.NET 2003. The language which Im working is VB.NET 2003. I have an access database using the JET OLEDB connection and data adapter type. I have created a program that will (sort of) manipulate this database.

This database has a few different tables. Just for examples sake let's say they are Scannerlog and Equiplog. Scannerlog table is just text fields that can be bound to textboxes without any problems (no problems here). However, the equiplog has text fields AS WELL as Boolean (yes/no) fields. I can bind the text fields to text boxes and vice versa, however Im having EXTREME difficulty getting checkboxes to correctly bind with the Boolean (yes/no) fields in the database. When binding Im using the checked control property and receive an error stating that I cannot cast DBnull to other types. Any ideas on what I can do to fix this issue?

One last question I have (isnt as critical) is that I have a search feature setup that can search the databases certain table for a certain string in a column and if the string is found it will do some operation form.show() . Which is what I want, EXCEPT, I would like it to fill the form with the correct strings and values according to the certain string I searched for. Lets say for example, I search for the string Bob in the Name Column. If Bob is returned then I want it to show the personal information form with all of bobs information (address, name, phone number, etc) in the appropriate textboxes respectively. As of right now I can get the form to display if bob is returned but none of Bobs information is in the textboxes. Any tips and/or advice would be greatly appreciated.
Thanks,
Jason T.


Comments

  • HackmanCHackmanC Member Posts: 441
    Very annoying thing, dont you think ?

    My first test about two or tree years ago, i made a form with the wizard, with two fields boolean, at insert time that was the DBNull thing ... very anoying thing that. (With the Wizard !).

    My fast approach ...

    Dim b As Binding = New Binding ("Text", ds, "customers.YesNo")
    AddHandler b.Format, AddressOf MyFormat

    Private Sub MyFormat(sender As Object, cevent As _
    ConvertEventArgs)
    If Not cevent.DesiredType Is GetType(Boolean) Then
    Exit Sub
    End If

    If cevent.Value = System.DBNull.Value Then _
    cevent.Value = False
    End Sub

    -------------------
    : First let me make myself clear and say that I’m not asking you to debug any code. I’m using VS Studio.NET 2003. The language which I’m working is VB.NET 2003. I have an access database using the JET OLEDB connection and data adapter type. I have created a program that will (sort of) manipulate this database.
    :
    : This database has a few different tables. Just for examples sake let's say they are Scannerlog and Equiplog. Scannerlog table is just text fields that can be bound to textboxes without any problems (no problems here). However, the equiplog has text fields AS WELL as Boolean (yes/no) fields. I can bind the text fields to text boxes and vice versa, however I’m having EXTREME difficulty getting checkboxes to correctly bind with the Boolean (yes/no) fields in the database. When binding I’m using the “checked” control property and receive an error stating that I cannot cast DBnull to other types. Any ideas on what I can do to fix this issue?
    :
    : One last question I have (isn’t as critical) is that I have a search feature setup that can search the database’s certain table for a certain ‘string’ in a column and if the string is found it will do ‘some’ operation form.show() . Which is what I want, EXCEPT, I would like it to fill the form with the correct strings and values according to the certain string I searched for. Let’s say for example, I search for the string ‘Bob’ in the Name Column. If ‘Bob’ is returned then I want it to show the personal information form with all of bobs information (address, name, phone number, etc) in the appropriate textboxes respectively. As of right now I can get the form to display if bob is returned but none of Bobs information is in the textboxes. Any tips and/or advice would be greatly appreciated.
    : Thanks,
    : Jason T.
    :
    :
    :

    [red]Good luck![/red]
    [blue]Hackman[/blue]

Sign In or Register to comment.