PC Review


Reply
Thread Tools Rate Thread

how to check if theres no entry in the accessdatabase

 
 
Drygast
Guest
Posts: n/a
 
      12th Oct 2003
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




 
Reply With Quote
 
 
 
 
Cor
Guest
Posts: n/a
 
      12th Oct 2003
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


 
Reply With Quote
 
Drygast
Guest
Posts: n/a
 
      12th Oct 2003
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" <(E-Mail Removed)> wrote in message
news:3f895210$0$11697$(E-Mail Removed)...
> 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
>
>



 
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
Simply Identifying the location (in My Documents) of the AccessDatabase that I have open Dave K Microsoft Access 3 8th Mar 2008 05:42 PM
Entry into check box dependent on other check box. =?Utf-8?B?U3RpbGxh?= Microsoft Excel Worksheet Functions 9 10th Dec 2005 03:44 PM
Locked Accessdatabase =?Utf-8?B?b3JqYW4=?= Microsoft Access 1 3rd Feb 2005 12:33 AM
Re: Saving Objects to Accessdatabase 2002 with VB .Net Abrie Microsoft Access Database Table Design 1 22nd Nov 2003 12:42 PM
Re: how to check if theres no entry in the accessdatabase Drygast Microsoft VB .NET 4 13th Oct 2003 07:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:32 AM.