473,407 Members | 2,314 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,407 software developers and data experts.

Missing rows in DataReader

JC
Hi,

I have a stored Proc being called from a a c# class that is passing a
resulting datareader back to a windows form , to build a drop down.
The really odd thing is, only a handfull of the records returned from
the SP actauly show up in the datareader - e.g. when I called the SP
in Query Analyser ti shows loads more records. I'm confused, so any
help woudl be appreciated. Thanks

**************************SP********************** *********
CREATE PROCEDURE JC_TEST
AS
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG =
'MyDb' AND TABLE_NAME != 'dtproperties' AND TABLE_NAME !=
'sysconstraints' AND TABLE_NAME != 'syssegments' ORDER BY TABLE_TYPE
ASC, TABLE_NAME ASC
GO
************************************************** **********
************************DATACLASS***************** ***********
public SqlDataReader GetTables()
{
string sSql = "JC_TEST";
SqlConnection oCon = new SqlConnection(_ConnectionString);
SqlCommand oCmm = new SqlCommand();
oCmm.Connection = oCon;
oCmm.CommandText = sSql;
oCmm.CommandType = CommandType.StoredProcedure;

oCon.Open();
SqlDataReader oDataReader =
oCmm.ExecuteReader(CommandBehavior.CloseConnection );
return oDataReader;
}
************************************************** ***************
************************Form********************** ***************
private void PopulateTables()
{
System.Data.SqlClient.SqlDataReader oDr = oDd.GetTables();

while(oDr.Read())
{
comboBox1.Items.Add(oDr["TABLE_NAME"].ToString());
comboBox1.ValueMember = "TABLE_NAME";
label3.Text += oDr["TABLE_NAME"].ToString() + "\n";
}
oDr.Close();
}
************************************************** **************

also, I'm quite new to .net, so if you can see any glaringly amatuer
things in my code please tell me. Thanks

JC
Nov 18 '05 #1
0 1094

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

Similar topics

1
by: Claudia Fong | last post by:
Hi, I'm using a DataReader to connect to a db and retrieve data from the db. I just wondering how can I know the numbers of rows contain in my DB for the sql statement I used? For example, if...
14
by: Jacko | last post by:
Hi guys, Say I made a SELECT statement to my sql DB that would return 50 rows that I will use a sqldatareader to access. Instead of iterating through each and every row of the datareader, I'd...
2
by: Andrew | last post by:
Hey all, Have a strange one here, and being still fairly new to .NET isn't helping me understand it. I am having a problem where a DataReader doesn't return all the rows when I try to use a...
1
by: ae | last post by:
My datareader looks like this where dtrItemList is the datareader and chklExceptionList is my checkboxlist. the rows come in just fine, but I need help also including the name of the columns for...
2
by: Mattyw | last post by:
Hi I have a sqlcommand that returns all the rows in a column and then pass that to a datareader. I am new to VS.Net and so far I can only return the first row in the first column using ...
17
by: Justin Emlay | last post by:
I'm hopping someone can help me out on a payroll project I need to implement. To start we are dealing with payroll periods. So we are dealing with an exact 10 days (Monday - Friday, 2 weeks). ...
3
by: hazz | last post by:
The datareader below contains two rows of two columns but in the for loop, the values for only the first row are getting printed twice. How do I get to the values of the second row? Thanks. -hazz...
6
by: dew | last post by:
How do I get the number of rows a datareader has? I can tell HasRows, but not how many. Thanks.
2
by: Andy B | last post by:
How would you find out if a linq table has 0 rows in it? I have this code: NewsContext.V_News() '*** linq table to be tested for 0 rows Any ideas?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...

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.