Click here to Skip to main content
11,790,021 members (52,842 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB Visual-Studio VB.NET
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 at 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 at 28-Nov-12 10:32am
What function are you using to exeecute the query? Executenonquery?
Krunal R at 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
0 OriginalGriff 1,029
1 Maciej Los 790
2 KrunalRohit 686
3 CPallini 606
4 Richard MacCutchan 460

Advertise | Privacy | Mobile
Web03 | 2.8.1509028.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2015
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