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

C# DataTable Question

Hi,

C# Windows Form project.

string strQry="SELECT * FROM Customer WHERE CustName='John Doe' ";
SqlDataAdapter MySqlDataAdapter =new
SqlDataAdapter(strQry,rConn.ConnectionString);
MySqlDataAdapter.Fill(MyDataSet,"MyDataTable");
And the MyDataTable now has a Row like this:
00000001 John Doe
,so in the MyDataTable the Rows.Count=1

But if the strQry="SELECT * FROM Customer WHERE CustName='John DDDDoe' ",
and in my database there's no 'John DDDDoe' in Customer.
but the MyDataTable the Rows.Count=1 also.

What will be a more direct solution to tell if the MyDataTable has a REAL
row?
Thanks for help.
Jason


Feb 11 '06 #1
3 2124
MyDataTable the Rows.Count=0, but MyDataSet.Tables.Count=1

C# Windows Form project.

string strQry="SELECT * FROM Customer WHERE CustName='John Doe' ";
SqlDataAdapter MySqlDataAdapter =new
SqlDataAdapter(strQry,rConn.ConnectionString);
MySqlDataAdapter.Fill(MyDataSet,"MyDataTable");
And the MyDataTable now has a Row like this:
00000001 John Doe
,so in the MyDataTable the Rows.Count=1

But if the strQry="SELECT * FROM Customer WHERE CustName='John DDDDoe' ",
and in my database there's no 'John DDDDoe' in Customer.
but the MyDataTable the Rows.Count=1 also.


What will be a more direct solution to tell if the MyDataTable has a REAL
row?
Thanks for help.
Jason

Feb 11 '06 #2
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:OI**************@TK2MSFTNGP15.phx.gbl...
MyDataTable the Rows.Count=0, but MyDataSet.Tables.Count=1


??? That would be correct - what's the problem?
Feb 11 '06 #3
Hi Jason,

This is because the data structure of the table is loaded, thats why
the table count is 1. Since there are no rows rowCount is 0.

Cheers,
Kris

Feb 11 '06 #4

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

Similar topics

5
by: Stefan Turalski \(stic\) | last post by:
Hi, I'm wondering if there is a way to send a method parametrs by ref when DataTabel is a type of this value ? I done some sort of select over DataTable columns, just by removing them froma...
1
by: Mike | last post by:
I have an ASP.NET/VB app that updates values in a DataTable over the course of about 3 different pages. On the way out of the first of these pages, I explicitly build the DataTable from values in...
2
by: JohnR | last post by:
Sorry if this is has an obvious answer, but I can't find it... I am using a datatable.select to obtain the rows in a datatable that meet certain criteria. My question is this: for each of the...
6
by: Danny Ni | last post by:
Hi, If I want to programatically add rows to a DataTable, do I call AcceptChanges per row? Or do I call AcceptChanges after all rows added? TIA
1
by: kempshall | last post by:
Hi, I have a question about the .NET DataTable.ImportRow method. If I import a DataRow into an empty DataTable, will the empty DataTable pick up the schema of the DataRow I'm trying to put into...
4
by: George | last post by:
Got a question about the side effect of DataAdapter.Update() and DataTable.GetChanges(). Say I set up a DataTable and a DataAdapter in a class. Delete (Not remove) a row in the data table and...
1
by: VMI | last post by:
When my webpage loads the first time, I fill my datatable with records from the DB and display them in my gridview. Once it loads, the user clicks on a button and add records to the datatable,...
1
by: Maxwell2006 | last post by:
Hi, I am working with strongly typed datatables. What is the most efficient way to build a new DataTAble based on the result of DataTable.Select? At this point I use a foreach loop to do the...
5
by: jehugaleahsa | last post by:
Hello: What is the point of using a DataTable in ASP .NET? We are unsure how you can use them without 1) rebuilding them every postback, or 2) taking up precious memory. We are not sure how to...
9
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a routine that builds a table using different queries, different SQL Tables, and adding custom fields. It takes a while to run (20 - 45 seconds) so I wrote a thread to handle the table...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.