C# DataTable Question

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top