1
Reply

how to count the row in the datagridview in csharp using select command?

Black Diamond

Black Diamond

Aug 29 2011 5:28 AM
1.4k

daCaptain.SelectCommand = new SqlCommand("SELECT Top 5 * FROM Captain", cs);

dsCaptain.Clear();

daCaptain.Fill(dsCaptain);

dgCaptainVoters.DataSource = dsCaptain.Tables[0];

tblNamesBSCaptain.DataSource = dsCaptain.Tables[0];

hi everyone, please help me to code something like this...this code display the datagridview until 5 rows, so i want that i have a code that watch my sql server database table stored only ontil 5 records or rows, if it reach 5 record the adding records to the database will stop...is this posible? please help me.


Answers (1)