Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / October 2004



Tip: Looking for answers? Try searching our database.

How to check an empty recordset?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sebastian Hort - 29 Oct 2004 12:28 GMT
If the database returns an NULLvalue, how can i check this?

I tried to check at objfield="" or NULL but it doesn`t work.

Any hints? thx
Al Reid - 29 Oct 2004 12:31 GMT
> If the database returns an NULLvalue, how can i check this?
>
> I tried to check at objfield="" or NULL but it doesn`t work.
>
> Any hints? thx

Try the IsNull() Function.

If you know the field is a string type, you can simply append an empty string to the field value => rs(0).Value & ""

Signature

Al Reid

How will I know when I get there...
If I don't know where I'm going?

Sebastian Hort - 29 Oct 2004 13:48 GMT
thanks :)
Val Mazur - 30 Oct 2004 02:17 GMT
Hi,

I would say that using IsNull function is better just because it was
designed to do this job. Empty string result during concatenation with NULL
is not documented and cannot be guaranteed and it does not work in a case of
numeric or date values.

Signature

Val Mazur
Microsoft MVP

> thanks :)
Al Reid - 30 Oct 2004 02:29 GMT
> Hi,
>
> I would say that using IsNull function is better just because it was
> designed to do this job. Empty string result during concatenation with NULL
> is not documented and cannot be guaranteed and it does not work in a case of
> numeric or date values.

I agree that empty string concatenation is not documented, but it can be
guaranteed to work with Null string values AND since VB is now at EOL the
behavior is not going to change.  I think this still works with VB.Net as
well.
Signature

--
Al Reid

Val Mazur - 30 Oct 2004 02:53 GMT
Yes, it works in .NET as well because all NULL strings converted into empty
one during concatenation

Signature

Val Mazur
Microsoft MVP

>> Hi,
>>
[quoted text clipped - 9 lines]
> behavior is not going to change.  I think this still works with VB.Net as
> well.
Douglas J. Steele - 29 Oct 2004 13:42 GMT
If you're asking how can you tell if a returned recordset has no rows in it,
check whether (rs.BOF = True And rs.EOF = True)

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> If the database returns an NULLvalue, how can i check this?
>
> I tried to check at objfield="" or NULL but it doesn`t work.
>
> Any hints? thx
Sebastian Hort - 29 Oct 2004 13:48 GMT
Veign - 30 Oct 2004 01:43 GMT
There is no need to check for BOF as an empty recordset will set EOF.

Signature

Chris Hanscom - Microsoft MVP (VB)
http://www.veign.com
--

> If you're asking how can you tell if a returned recordset has no rows in it,
> check whether (rs.BOF = True And rs.EOF = True)
[quoted text clipped - 4 lines]
> >
> > Any hints? thx
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.