By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,682 Members | 1,401 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,682 IT Pros & Developers. It's quick & easy.

how to check if theres no entry in the accessdatabase

P: n/a
Hi,

I'm having some problems getting my program to work as I would like it to.
This is because i whish to check if the entered number exists in an
accessdatabase, if i doesn't I
would like to call a form where I can enter the number to the database....

the code:

______________
If Not myReader.GetInt32(1).ToString = txtOrdernummer.Text Then

If MessageBox.Show(("Ordern finns inte i databasen!" & vbCrLf & vbCrLf &
"vill du registrera ordern?"), "Hittar ej ordern", MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation) = DialogResult.Yes Then

Dim oForm2 As Form2

oForm2 = New Form2

oForm2.Show()

oForm2 = Nothing

End If

End If

______________
I realize that this code is not correct, but I don't know what I should
type instead:

If Not myReader.GetInt32(1).ToString = txtOrdernummer.Text Then

It won't work with "if Not myReader.IsDbNull then" either, it must be cause
I don't even get a null answer but as I said:

how do I solve this?

Regards

/Drygast


Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Cor
Hi Drygast,
I think you are not debugging, but why not make it simple for yourself.
Put in this place a while
'''''''If Not myReader.GetInt32(1).ToString = txtOrdernummer.Text Then

Messagebox.show(myReader.GetInt32(1).ToString )
then you know what the value is.
I hope this helps
Cor
Nov 20 '05 #2

P: n/a
Hi Cor,

following your example this is the response:

"An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll

Additional information: No data exists for the row/column."

Any ideas?
I don't think this is a problem though, I just need to be able to catch the
event and when "No data exists for the row" happens
I call another form where I can enter the data (ordernumber). I just don't
know the code to do it (newbie-programmer)
/Drygast
"Cor" <no*@non.com> wrote in message
news:3f***********************@reader21.wxs.nl...
Hi Drygast,
I think you are not debugging, but why not make it simple for yourself.
Put in this place a while
'''''''If Not myReader.GetInt32(1).ToString = txtOrdernummer.Text Then

Messagebox.show(myReader.GetInt32(1).ToString )
then you know what the value is.
I hope this helps
Cor

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.