|
-
Aug 3rd, 2004, 01:57 PM
#1
Thread Starter
Junior Member
How to find the number of rows read into a data source
Hey,
I have an access database (soon to be SQL) that I have read over 3000 rows into a data source. I have to use the number of rows to do some of the programming. How do I find out the number of rows as it will be different with many different files that this will use.
I am using VB.net
Thanks,
Nicholas
-
Aug 3rd, 2004, 02:01 PM
#2
I wonder how many charact
have an access database (soon to be SQL) that I have read over 3000 rows into a data source. I have to use the number of rows to do some of the programming. How do I find out the number of rows as it will be different with many different files that this will use.
You mean you have read them into a dataset? In that case, you would simply call the appropriate table's rows.count property.
I'm also curious as to how the number of rows affects your programming...
Post your code...
-
Aug 3rd, 2004, 02:10 PM
#3
Thread Starter
Junior Member
Hey,
Thanks for your help. Is there some please where I can find all of the properties such as "rows.count".
Would you mind giving me a short example even if it is just the row of what "rows.count" goes with.
I cannot give you my code though due to it being work related. But I am running a program that gets data that is put into once a week and I have to do some checking and comparing with it so I have to go through each row and need the number of rows for the "for loop". So I can hit the end of the file and stop at that. Since the number of rows change every week it will continue to go after the last row if I do not put a limit in there and I cannot change it every week.
Thanks so much!!!!
Nicholas
-
Aug 3rd, 2004, 02:24 PM
#4
I wonder how many charact
VB Code:
Dim count As Integer = 0
while dr.read
count +=1
'...
end while
-
Aug 3rd, 2004, 02:27 PM
#5
Thread Starter
Junior Member
I use the "OleDbDataAdapter1.Fill" and it fills the data for me. How do I do that when it automaticly fills the data for me??
-
Aug 3rd, 2004, 02:31 PM
#6
I wonder how many charact
What's the name of the dataset you are filling?
How many tables does it have?
What table is the table you want to know how many rows it has?
VB Code:
dataAdaptor1.Fill(ds)
Dim rowscount As Integer = ds.Tables(0).Rows.Count
Btw, in Visual Studio, simply highlight a line of code with DataTable in it, and press F1....(or click Help.. Index... Type 'DataTable', hit ENTER, click on DataTable Class) it will bring up a complete summary of the DataTable class.
-
Aug 3rd, 2004, 02:41 PM
#7
Thread Starter
Junior Member
HEY THANKS!!!!!!
That worked GREAT!!!!!
Were do you find out those type of things "Dim rowscount As Integer = ds.Tables(0).Rows.Count"
I have needed several types of these and is there a book that has them or any website that has them???
Also I only have one table does the "0" in the perenteses make a different??? I left it as zero. If I had more than 1 table would it be different??
THANKS SO MUCH!!
Nicholas
-
Aug 3rd, 2004, 02:57 PM
#8
I wonder how many charact
HELP:
MSDN LIBRARY
http://msdn.microsoft.com/library/de...ClassTopic.asp
BOOKS:
There really is one book you absolutely need... it only has 3 chapters on ADO, but they are pretty comprehensive.
Programming Microsoft Visual Basic .NET - Francesco Balena
http://www.amazon.com/exec/obidos/tg...97645?v=glance
-
Aug 3rd, 2004, 03:03 PM
#9
Thread Starter
Junior Member
Thanks for all of your Help!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|