473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

DBNUL Errors Continued

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(By Val 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(dsPassw ordList,
"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.Mess age)
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.Messa ge)
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

Nov 21 '05 #1
4 1325
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
Nov 21 '05 #2
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" <no**********@planet.nl> wrote in message
news:O6**************@TK2MSFTNGP09.phx.gbl...
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

Nov 21 '05 #3
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
Nov 21 '05 #4
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" <no**********@planet.nl> wrote in message
news:uI**************@tk2msftngp13.phx.gbl...
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

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Aaron W. LaFramboise | last post by:
I'm seeking a solution to my C++-life long dilemma of how to deal with errors when exceptions aren't appropriate. Below I highlight two error cases, which mainly occur when trying to handle...
12
by: Russ | last post by:
Hello. My new dev machine is running XP Pro. In the past all equipment has only used Windows 2000. I have had a lot of problems getting my projects up and running on the new machine. The current...
0
by: Nunya Biznas | last post by:
I have a two column report that needs to have the word "continued" appear at the top of the 2nd column if the detail records are part of the group from the previous column. I have tried using a...
2
by: Rajshekhar | last post by:
Hi all, Where can i get the complete details about the all types of errors and warnings that a C-compiler pops up..?? any pdfs or links or books to refer....! plz help me out.. Regards,...
4
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> ...
3
by: Andy2500 | last post by:
Sorry that I use the new post because when I replied in the old one, nothing display ! here is the code of the simplest example with its errors : ...
5
by: Andy2500 | last post by:
the reply doesn't work, I much post a new one , sorry !!!!! Hi ! Thank you for the reply $tmp_file=C:\WINNT\TEMP\php1C.tmp...
13
by: jacob navia | last post by:
Consider this nice C program: short long n; signed unsigned b; const long const long a; unsigned double w; signed float k; short double q; unsigned long double z;
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.