Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 24th, 2007, 02:17 AM
Registered User
 
Join Date: May 2007
Location: Hyderabad, A.P, India.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default iterating through cols. of a recordset

if i have a recordset "s" and I want to iterate through the cols in the rows. My problem is that I dont know how many cols. it has. How do I go about.

do while (not s.eof)
???????????????
s.movenext
loop

Reply With Quote
  #2 (permalink)  
Old May 24th, 2007, 02:58 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

snip.... here

<%
Dim StrStudentID
Dim sRst
Dim fCount

StrStudentID = Request.QueryString("sid")
Set sRst = Conn.Execute("Select * from NewRegistration where studentid = " & CLng(StrStudentId))
fCount = sRst.Fields.Count
For q = 1 to CInt(fCount)-1
%>
<TR><TD><%=sRst.fields(q).Name%></TD><TD><%=sRst.fields(q)%></TD></TR>
<%
Next
%>

Is that you were asking?

With Regards,
Raghavendra Mudugal
Reply With Quote
  #3 (permalink)  
Old May 24th, 2007, 03:17 AM
Registered User
 
Join Date: May 2007
Location: Hyderabad, A.P, India.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks buddy..
I saw in one of the sites.

MyArray=i.GetRows()
For lnRowCounter = 0 To Ubound(MyArray,2)
 For lnColumnCounter = 0 To Ubound(MyArray,1)
  Response.Write MyArray(lnColumnCounter, lnRowCounter)
Next
Next

*************
but urs is simpler.
Thanks again

Reply With Quote
  #4 (permalink)  
Old May 24th, 2007, 03:41 AM
Registered User
 
Join Date: May 2007
Location: Hyderabad, A.P, India.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The code runs fine but there is a small change-

for q = 0 to CInt(fCount)-1



Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Iterating through DropDownBox rsearing ASP.NET 2.0 Basics 8 January 3rd, 2007 04:35 PM
Iterating Fonts Ron Howerton Visual Basic 2005 Basics 9 May 31st, 2006 07:15 PM
Rows and Cols Stuff : MSHFlexGrid davekrunal46 VB How-To 1 December 2nd, 2005 01:21 AM
Comparing 2 cols. Hudson40 Excel VBA 5 February 9th, 2005 03:27 PM
Looking for Datagrid Cols&Columns reyboy Pro VB.NET 2002/2003 1 May 25th, 2004 08:12 AM



All times are GMT -4. The time now is 11:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.