473,238 Members | 1,757 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,238 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 2122
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.