PC Review


Reply
Thread Tools Rate Thread

DBNUL Errors Continued

 
 
MadCrazyNewbie
Guest
Posts: n/a
 
      16th Aug 2004
Hey Group,

Please bare with me ehile I try and explain, i think i maybe on the wrong
track but this is driving me crazy now

I have the following code:

Private Sub frmMainMenuPasswords_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
odcPasswordLists.ConnectionString = Connection.String

cmDsPasswordList = BindingContext(dsPasswordList, "PasswordList")
mlLoading = True
'Start of Fill Datasets
Try
dsPasswordList.EnforceConstraints = False
Try
Me.odcPasswordLists.Open()
'Fill Password Lists Datasets
Me.odaDepartments.Fill(dsPasswordList)
Me.odaPasswordList.Fill(dsPasswordList)
Catch fillException As System.Exception
Throw fillException
Finally
'To be enabled if Dataset Bindings Fail - Enabling will
cause BIG Datasets
'dsPasswordList.EnforceConstraints = True
Me.odcPasswordLists.Close()
End Try
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message)
Finally
mlLoading = False
End Try
'End of Fill Datasets
End Sub

'Start of Position Changed Code - Password Lists
Private Sub cmDsPasswordList_PositionChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cmDsPasswordList.PositionChanged
DsPasswordList_PositionChanged()
End Sub

Private Sub cboPasswordListsDepartment_SelectedIndexChanged(ByVal sender
As Object, ByVal e As System.EventArgs) Handles
cboPasswordListsDepartment.SelectedIndexChanged
Me.BindingContext(dsPasswordList, "PasswordList").EndCurrentEdit()
If Me.BindingContext(dsPasswordList, "PasswordList").Position <> -1
And Not mlLoading Then

dsPasswordList.PasswordList.Rows(Me.BindingContext(dsPasswordList,
"PasswordList").Position).Item("DepartmentID") =
Me.cboPasswordListsDepartment.SelectedValue
End If
End Sub

Private Sub DsPasswordList_PositionChanged()
Me.BindingContext(dsPasswordList, "PasswordList").EndCurrentEdit()
If Me.BindingContext(dsPasswordList, "PasswordList").Position <> -1
And Not mlLoading Then
Me.cboPasswordListsDepartment.SelectedValue =
dsPasswordList.PasswordList.Rows(Me.BindingContext(dsPasswordList,
"PasswordList").Position).Item("DepartmentID")
End If
End Sub
'End of Position Changed Code - Password Lists

'PasswordLists Code Start
Private Sub btnPasswordListsDelete_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsDelete.Click
If MessageBox.Show("Are Your Sure You Want To Delete?",
"WARNING!!!!", MessageBoxButtons.OKCancel) = DialogResult.OK Then
If (Me.BindingContext(dsPasswordList, "PasswordList").Count > 0)
Then
Me.BindingContext(dsPasswordList,
"PasswordList").RemoveAt(Me.BindingContext(dsPasswordList,
"PasswordList").Position)
End If
End If
End Sub

Private Sub btnPasswordListsAdd_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsAdd.Click
'Reset Combo Box`s - Select Index Twice due to M$ Bug
cboPasswordListsDepartment.Text = ""
cboPasswordListsDepartment.SelectedIndex = -1
cboPasswordListsDepartment.SelectedIndex = -1

txtPasswordListsAccessLevel.Enabled = True
txtPasswordListsID.Enabled = True
txtPasswordListsNotes.Enabled = True
txtPasswordListsPassword.Enabled = True
txtPasswordListsPrimaryUse.Enabled = True
txtPasswordListsPrimaryUser.Enabled = True
txtPasswordListsSystem.Enabled = True
txtPasswordListsUsername.Enabled = True
txtPasswordListsWebAddress.Enabled = True
dtpPasswordLists.Enabled = True
cboPasswordListsDepartment.Enabled = True
Try
Me.BindingContext(dsPasswordList,
"PasswordList").EndCurrentEdit()
Me.BindingContext(dsPasswordList, "PasswordList").AddNew()
Catch eEndEdit As System.Exception
System.Windows.Forms.MessageBox.Show(eEndEdit.Message)
End Try
End Sub

Private Sub btnPasswordListsCancel_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsCancel.Click
Me.BindingContext(dsPasswordList,
"PasswordList").CancelCurrentEdit()
txtPasswordListsAccessLevel.Enabled = False
txtPasswordListsID.Enabled = False
txtPasswordListsNotes.Enabled = False
txtPasswordListsPassword.Enabled = False
txtPasswordListsPrimaryUse.Enabled = False
txtPasswordListsPrimaryUser.Enabled = False
txtPasswordListsSystem.Enabled = False
txtPasswordListsUsername.Enabled = False
txtPasswordListsWebAddress.Enabled = False
dtpPasswordLists.Enabled = False
cboPasswordListsDepartment.Enabled = False
End Sub

Private Sub btnPasswordListsUpdate_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsUpdate.Click
If MessageBox.Show("Are Your Sure You Want To Save Changes?",
"WARNING!!!!", MessageBoxButtons.OKCancel) = DialogResult.OK Then
Try
Dim objDataSetChanges As Excellence.NET.dsPasswordList = New
Excellence.NET.dsPasswordList()
Me.BindingContext(dsPasswordList,
"PasswordList").EndCurrentEdit()
objDataSetChanges = CType(dsPasswordList.GetChanges,
Excellence.NET.dsPasswordList)
If (Not (objDataSetChanges) Is Nothing) Then
Try
If (Not (dsPasswordList) Is Nothing) Then
Me.odcPasswordLists.Open()
odaDepartments.Update(dsPasswordList)
odaPasswordList.Update(dsPasswordList)
End If
Catch updateException As System.Exception
Throw updateException
Finally
Me.odcPasswordLists.Close()
End Try
End If
dsPasswordList.Merge(objDataSetChanges)
dsPasswordList.AcceptChanges()
Catch eUpdate As System.Exception
System.Windows.Forms.MessageBox.Show(eUpdate.Message)
End Try
txtPasswordListsAccessLevel.Enabled = False
txtPasswordListsID.Enabled = False
txtPasswordListsNotes.Enabled = False
txtPasswordListsPassword.Enabled = False
txtPasswordListsPrimaryUse.Enabled = False
txtPasswordListsPrimaryUser.Enabled = False
txtPasswordListsSystem.Enabled = False
txtPasswordListsUsername.Enabled = False
txtPasswordListsWebAddress.Enabled = False
dtpPasswordLists.Enabled = False
cboPasswordListsDepartment.Enabled = False
End If
End Sub

Private Sub btnPasswordListsEdit_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsEdit.Click
txtPasswordListsAccessLevel.Enabled = True
txtPasswordListsID.Enabled = True
txtPasswordListsNotes.Enabled = True
txtPasswordListsPassword.Enabled = True
txtPasswordListsPrimaryUse.Enabled = True
txtPasswordListsPrimaryUser.Enabled = True
txtPasswordListsSystem.Enabled = True
txtPasswordListsUsername.Enabled = True
txtPasswordListsWebAddress.Enabled = True
dtpPasswordLists.Enabled = True
cboPasswordListsDepartment.Enabled = True
End Sub
'PasswordLists Code Finish

When I try to run my Add code it errors on:

dsPasswordList.PasswordList.Rows(Me.BindingContext(dsPasswordList,
"PasswordList").Position).Item("DepartmentID") =
Me.cboPasswordListsDepartment.SelectedValue

And tells me it cannot user NULL and to use DBNULL instead so i put:

dsPasswordList.PasswordList.Rows(Me.BindingContext(dsPasswordList,
"PasswordList").Position).Item("DepartmentID") =
Me.cboPasswordListsDepartment.SelectedValue = system.DBNULL.value - but it
fails to compile and tells me:

D:\Excellence.Net\MainMenuPasswords.vb(1390): Operator '=' is not defined
for types 'System.Object' and 'System.DBNull'. Use 'Is' operator to compare
two reference types.

If I remove the following code from my project:

'Reset Combo Box`s - Select Index Twice due to M$ Bug
cboPasswordListsDepartment.Text = ""
cboPasswordListsDepartment.SelectedIndex = -1
cboPasswordListsDepartment.SelectedIndex = -1

It lets me add a row but then gives me a Concurrency Violation When I run my
Update Code.

Anybody got any Ideas?

Many Thanks and Sorry for the long Post
Regards
MCN



 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      17th Aug 2004
Simon,

I repeat, I thought you are using the wrong displayvalue in the comboboxes.
(Not visible in this part of your code because you have binded it using the
designer)

That returns a DBNull value and therefore you get this error. However
correcting that as described does not correct the problem.

However just guessing

Cor


 
Reply With Quote
 
MadCrazyNewbie
Guest
Posts: n/a
 
      17th Aug 2004
Sorry Cor,

Think my newsstream is well out of date, its so slow so im not getting the
posts stright away

What should the value be?

I`ve been looking at the errors, and also at the DataRows that I need to add
in, but im lost, as per my e-mail

I`ve been playing but keep seeming to make things worse

Hope you can help
Cheers
Simon

"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Simon,
>
> I repeat, I thought you are using the wrong displayvalue in the

comboboxes.
> (Not visible in this part of your code because you have binded it using

the
> designer)
>
> That returns a DBNull value and therefore you get this error. However
> correcting that as described does not correct the problem.
>
> However just guessing
>
> Cor
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      17th Aug 2004
I wrote that I do not believe that the way you are using it works, Because
you are using as displaymember something from a database table, which has a
reference in your access database, however you are loading it in your
selects without any reference as a completly seperated table.

So I think the most easiest way for this (because it is a small database)
can be using that same dataview approach as with the documents.

Cor


 
Reply With Quote
 
MadCrazyNewbie
Guest
Posts: n/a
 
      17th Aug 2004
Cor,

Im looking at the DataRow view just having trouble with it, i`ll get
something together and i`ll give you a shout if i get stuck, i`ve noticed
from reading the datarow is very comple to, next will be the concurrecny

Cheers Cor
MCN(Si)

"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I wrote that I do not believe that the way you are using it works, Because
> you are using as displaymember something from a database table, which has

a
> reference in your access database, however you are loading it in your
> selects without any reference as a completly seperated table.
>
> So I think the most easiest way for this (because it is a small database)
> can be using that same dataview approach as with the documents.
>
> Cor
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seagate drive check utility reports "errors in metadatea file records, other errors critical errors in metadata.." LQQK@mi.sig Storage Devices 0 3rd Feb 2006 04:48 AM
Continued svchost errors =?Utf-8?B?VGhlIEdpbXA=?= Windows XP Performance 1 3rd Apr 2005 02:05 AM
Can't Report Errors - Continued David Cavill Windows XP General 0 3rd Dec 2003 08:14 PM
continued Beth Stoeckly Windows XP Internet Explorer 1 11th Oct 2003 02:59 PM
Re: YTD continued John Vinson Microsoft Access Queries 0 15th Jul 2003 07:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:04 AM.