473,418 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Find size of GetString in DataReader (vb.net)

Hi All

I'm doing a 'select * from table' in my DataReader below and populating an
array with the results. Obvisouly I'm only getting the first field from the
results by the use of the GetString(0).

My Question is how do I find out how many elements there are to GetString
without having to know how many fields are in the table?

Thanks
-- Code

Dim List As New ArrayList()
Dim ListCount As Integer = 0
Dim ListReader As SqlDataReader = ListCmd.ExecuteReader()
While ListReader.Read()
List.Insert(ListCount, ListReader.GetString(0))
ListCount = ListCount + 1
End While

--
Nov 19 '05 #1
2 4082
Use the property SqlDataReader.FieldCount

"Lee Walters" <Le********@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
Hi All

I'm doing a 'select * from table' in my DataReader below and populating an
array with the results. Obvisouly I'm only getting the first field from the
results by the use of the GetString(0).

My Question is how do I find out how many elements there are to GetString
without having to know how many fields are in the table?

Thanks
-- Code

Dim List As New ArrayList()
Dim ListCount As Integer = 0
Dim ListReader As SqlDataReader = ListCmd.ExecuteReader()
While ListReader.Read()
List.Insert(ListCount, ListReader.GetString(0))
ListCount = ListCount + 1
End While

--

Nov 19 '05 #2
Thanks Shiva - Jus got back into work and seen your reply. Kind of worked it
out while I was away. Nice and easy one.

Anyway - thanks again.

"Shiva" wrote:
Use the property SqlDataReader.FieldCount

"Lee Walters" <Le********@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
Hi All

I'm doing a 'select * from table' in my DataReader below and populating an
array with the results. Obvisouly I'm only getting the first field from the
results by the use of the GetString(0).

My Question is how do I find out how many elements there are to GetString
without having to know how many fields are in the table?

Thanks
-- Code

Dim List As New ArrayList()
Dim ListCount As Integer = 0
Dim ListReader As SqlDataReader = ListCmd.ExecuteReader()
While ListReader.Read()
List.Insert(ListCount, ListReader.GetString(0))
ListCount = ListCount + 1
End While

--

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Manish Jain | last post by:
Platform: C# (Windows Application)/XP/Framework 1.1 ----------------------------------------------------------- Hi I am doing some performance checks, I am using a hashtable that I suspect is...
1
by: DaveF | last post by:
Is there an equivalent String = recordset.GetString(StringFormat, NumRows, ColumnDelimiter, RowDelimiter, NullExpr) -- David
3
by: TyBreaker | last post by:
I have a vbscript which returns the folder size of any folder instantly by referring to Folder.Size. I don't need any iteration or recursion through the subfolders, adding together individual file...
0
by: Nick | last post by:
How to set custom report size in vb .net?
43
by: Frodo Baggins | last post by:
Hi all, We are using strcpy to copy strings in our app. This gave us problems when the destination buffer is not large enough. As a workaround, we wanted to replace calls to strcpy with strncpy....
3
by: mahepep | last post by:
hi, please give the answer for this question. How do u find the path in .net application?
2
by: Chetanhl | last post by:
Hey guyz if i wanna know how to find size of unsigned char*? void func1(unsigned char* str) { int a; a=?? ////////////////now how to store size of str in a???? }
6
by: Gouri.Mahajan7 | last post by:
Hello, I am new to asp.net. Can anybody please tell me how to get current page size in asp.net...? Thanks in advance. Regards, Gouri.
7
by: Tapas Bose | last post by:
Hello. I want to find size of a dynamically allocated array in my following code : #include <iostream> #include <cstdlib> using namespace std; int main() {
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.