471,306 Members | 1,306 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 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 2092
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Danny Ni | last post: by
1 post views Thread by kempshall | last post: by
5 posts views Thread by jehugaleahsa | last post: by
9 posts views Thread by =?Utf-8?B?anAybXNmdA==?= | last post: by
reply views Thread by rosydwin | last post: by

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.