|
-
Sep 26th, 2011, 09:17 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] datagridview checking records
datagridview dgv is populated from a datatable dt.
Within dgv I can add records as the grid allows adding a new record.
Before clicking on the save button, how can I check if the added records is already present in the dgv?
Thanks
-
Sep 26th, 2011, 08:36 PM
#2
Re: datagridview checking records
How do you normally see what data is in the database? You execute a query. Same goes here. How do you specify what record to look for when you update or delete? With a WHERE clause. Same goes here. You obviously don't need the actual data, only to know whether it exists, so you can use the appropriate count function for your database. A non-zero result means that the data exists.
-
Sep 27th, 2011, 08:29 AM
#3
Thread Starter
Fanatic Member
Re: datagridview checking records
solved by checking the rowstate.
Thanks
-
Sep 27th, 2011, 09:19 AM
#4
Re: [RESOLVED] datagridview checking records
If that really was the solution then I must have severely misinterpreted the question. Maybe, or maybe not, you could then call the GetChanges method of the DataTable. You can specify a DataRowState and get a new Datatable containing just the rows with that state.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|