Click here to Skip to main content
13,191,400 members (83,422 online)
Rate this:
Please Sign up or sign in to vote.
Dear Coders,

I would like to check once I click on the save button on the Binding Navigator after entering the data in the form whether the data is Inserted into the Database or not. But there is no event in that save button. So Suggest me a solution for achieving it.
Posted 28-Nov-12 3:15am
Krunal R 28-Nov-12 9:25am
Try to count the number of rows before inserting data and after as well.. Compare that value and as per the result show MessageBox... Thats it :)
Mathlab 28-Nov-12 10:32am
What function are you using to exeecute the query? Executenonquery?
Krunal R 28-Nov-12 11:02am
string select = "select* from Employee";
SqlDataAdapter da = new SqlDataAdapter(select, con);
DataTable dt = new DataTable();

int count= dt.Rows.Count;

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Look at the link below, when you complete your query it will retun the number of rows affected by the query. You can do an if test after that to check to see if the number of rows returned is greater than 0 and perform whatever action you need.[^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171017.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100