Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Field in code?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Field in code?

 Post Reply Post Reply Page  <12
Author
Boecky View Drop Down
Groupie
Groupie
Avatar

Joined: 23 December 2002
Location: Belgium
Status: Offline
Points: 110
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boecky Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2004 at 3:48am
Ok, and as what i have to declare the QueryReturn?
Back to Top
Boecky View Drop Down
Groupie
Groupie
Avatar

Joined: 23 December 2002
Location: Belgium
Status: Offline
Points: 110
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boecky Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2004 at 5:24am
I also found this that also works:

If Not objReader.Read() Then

Panel1.Visible = False

End If

Back to Top
Boecky View Drop Down
Groupie
Groupie
Avatar

Joined: 23 December 2002
Location: Belgium
Status: Offline
Points: 110
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boecky Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2004 at 6:57am

hmm, this seems not to be a good solution, when there is 1 record, it will be hidden, also if there are more records, the first one is always not showed

Suggestions are welcome

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2004 at 7:15am

This is the way i iterate through a DataReader

If objReader.HasRows() then
     While objReader.Read()
        'here we are iterating through the results
     End While
Else
     'No results
End if

Note that "HasRows()" is a .NET Framework 1.1 and above thing

Contribute to the working anarchy we fondly call the Internet
Back to Top
Boecky View Drop Down
Groupie
Groupie
Avatar

Joined: 23 December 2002
Location: Belgium
Status: Offline
Points: 110
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boecky Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2004 at 10:24am

Thanks

I also found something else and this time it works also!

Repeater.DataBind()

Dim test As Integer

test = Repeater.Items.Count()

If (test = 0) Then

Panel1.Visible = False

Else

Panel1.Visible = True

End If



Edited by Boecky
Back to Top
Leeb65 View Drop Down
Groupie
Groupie


Joined: 05 December 2003
Location: Germany
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Leeb65 Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2004 at 10:28am

You could have just done a count query and then set the visability to true if greater than 0.

Lee

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2004 at 2:05pm
Originally posted by Boecky Boecky wrote:

Thanks

I also found something else and this time it works also!

Repeater.DataBind()

Dim test As Integer

test = Repeater.Items.Count()

If (test = 0) Then

Panel1.Visible = False

Else

Panel1.Visible = True

End If

can all be done in one line of code

Panel1.Visible = ( Repeater.Items.Count() > 0 )

Contribute to the working anarchy we fondly call the Internet
Back to Top
Boecky View Drop Down
Groupie
Groupie
Avatar

Joined: 23 December 2002
Location: Belgium
Status: Offline
Points: 110
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boecky Quote  Post ReplyReply Direct Link To This Post Posted: 19 January 2004 at 3:25pm
idd...much shorter
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.