473,385 Members | 1,919 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,385 software developers and data experts.

how to check if theres no entry in the accessdatabase

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
2 1016
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ratlhead | last post by:
Hey all, I've provided a form for a client of the company I work for that basically emails the form data to an email address. Only a couple of the many fields are required...nothing too fancy....
0
by: eXeonical | last post by:
How do i check if there is something new in STDIN? I ran into this problem when i was doing some simple command line script that takes input from STDIN. And i noticed that feof() always returns...
8
by: Travis Spencer | last post by:
Hello, I am trying to expose a C++ class to C clients using a C-compatible wrapper API. While doing so, I hit a little snag. When a C client deletes one on my classes using the provided delete...
3
by: KathyB | last post by:
Hi, I'm trying to find a way to validate input text boxes where I don't know the names until the page is rendered. I've got 2 validate functions that fire with the onsubmit button of a "mini" form...
5
by: Steve Wylie | last post by:
I am constructing an HTML questionnaire and one of the questions requires people to rate some choices from 1 to 5, where 1 is their favourite and 5 is their least favourite: Car Bus Taxi cab...
0
by: Mats | last post by:
Hi! I have a Windows 2000 computer (let's call it Comp1) that is used as a web server and i have an other computer (Comp2) that has a filebased access-database. How can i through ASP from...
1
by: erkwong | last post by:
Hello, What would be the simplist way to get the current date to populate a text box upon the de-selecting of a check-box (aka making the check box field false?) This is basically what I had...
8
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on...
4
by: laredotornado | last post by:
Hi, I'm using php 4.4.4. How do i check if a given variable is an array or simply a scalar? Thanks, - Dave
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.