Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello all I have got problem with counting row in dataset I have connected to database

C#
String^ constring=L"datasource=localhost;port=3306;username=root;password=kocurka12";
                MySqlConnection^ conDataBase=gcnew MySqlConnection(constring);
                MySqlCommand^ cmdDataBase=gcnew MySqlCommand("select * from database.new_table where model ='"+this->Search->Text+"' ",conDataBase);

                try{

               MySqlDataAdapter^ sda=gcnew MySqlDataAdapter();
               sda->SelectCommand=cmdDataBase;
               DataTable^ dbDataSet= gcnew DataTable();
               sda->Fill(dbDataSet);
               BindingSource^ bSource = gcnew BindingSource();




               bSource->DataSource=dbDataSet;
               dataGridView1->DataSource =bSource;
               sda->Update(dbDataSet);


                } catch(Exception^ ex){
                    MessageBox::Show(ex->Message);
                }







        }

now I Would like to pull numbers of rows in dataset unfortunately using dbDataSt.Tables("new_Table").Rows.Count; does not work for some reason always some problems any one would help??
Posted
Comments
Maciej Los 12-Jul-14 17:34pm    
Try: dbDataSet.Rows.Count
Maciej Los 12-Jul-14 18:23pm    
Tak, jestem Polakiem ;)

1 solution

SELECT COUNT(*) FROM database.new_table where MODEL= ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900