Deleting record from bindingsource

Hi

I have a winform app with form control bound to a binding source 
TblClientsBindingSource. The binding source has a data table as its data 
source as per below code;

dAdapter = New OleDbDataAdapter("SELECT * FROM tblClients WHERE ...", Conn)
dAdapter.Fill(dTable)
TblClientsBindingSource.DataSource = dTable

My question is; how do I delete the record currently pointed to by the 
binding source from the backend database table tblClients?

Thanks

Regards




0
John
2/28/2010 2:52:25 AM
dotnet.languages.vb 830 articles. 0 followers. Follow

2 Replies
2453 Views

Similar Articles

[PageSpeed] 29

John wrote:
> Hi
> 
> I have a winform app with form control bound to a binding source 
> TblClientsBindingSource. The binding source has a data table as its data 
> source as per below code;
> 
> dAdapter = New OleDbDataAdapter("SELECT * FROM tblClients WHERE ...", Conn)
> dAdapter.Fill(dTable)
> TblClientsBindingSource.DataSource = dTable
> 
> My question is; how do I delete the record currently pointed to by the 
> binding source from the backend database table tblClients?
> 
> Thanks
> 
> Regards
> 

It must be bound to some control.  The control is bound on a 
DataMemeberValue from the bound source, which would have the record's 
key. You need to get the key to the record from the control that's bound 
to the bounding source.

If the binding control is like a DataGridView, then you would select the 
record in the DataGridView on SelectedIndexChanged event of the control 
using SlectedValue that has the key to the record to delete.

You would have a Delete button with a buton click event that will take 
the SelectedValue and go back to the database with some routine to 
delete the row out of the table by key.

The button click event would have code in it to do your binding source 
and bind the source to the control again. The record is deleted, you get 
the data from the table again, the record is not there now, and you bind 
   the new data to the control.

0
Mr
2/28/2010 3:22:45 AM
Don't use dTable but dTable.DefaultView

To that you can add a rowfilter
dTable.DefaultView.rowfilter = "CustomersName = John"

The Class type of the DefaultView is DataView

Success


"John" <info@nospam.infovis.co.uk> wrote in message 
news:u7v$NECuKHA.4220@TK2MSFTNGP05.phx.gbl...
> Hi
>
> I have a winform app with form control bound to a binding source 
> TblClientsBindingSource. The binding source has a data table as its data 
> source as per below code;
>
> dAdapter = New OleDbDataAdapter("SELECT * FROM tblClients WHERE ...", 
> Conn)
> dAdapter.Fill(dTable)
> TblClientsBindingSource.DataSource = dTable
>
> My question is; how do I delete the record currently pointed to by the 
> binding source from the backend database table tblClients?
>
> Thanks
>
> Regards
>
>
>
> 
0
Cor
2/28/2010 7:55:36 AM
Reply:

Similar Artilces:

deleting borders or margins
how do I get rid of the many margins or left hand borders in an email ? Is this on messages that have been replied to or forwarded several times? You can try this to remove the forwards: http://www.dsoft.com.tr/stripmail/ -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. ALWAYS post your Outlook version. How to ask a question: http://support.microsoft.com/KB/555375 After furious head scratching, Kavebare asked: | how do I get rid of the many margins or left hand borders in an email | ? ...

can I delete an email through system manager or other utility
I support a large network and occasionally spam will get through and cause problems with my veritas backup. I know which email caused the problem and who's mailbox it lives in. Is there a way I can delete from the server or with another utility without going through the users outlook. you can exmerge it out of the mailbox if you have the exact subject line...but I do not see how spam getting through could cause problems with your backups... "darren" <darren@yahoo.com> wrote in message news:%23jZ6hS%23nEHA.3908@TK2MSFTNGP09.phx.gbl... > I support a large network and ...

adding lines of code to a macro to delete rows
Hello: As the last step of a macro that I have written, I need all rows at the end of this spreadsheet to be deleted. (The rows at the end of the spreadsheet have bogus data, and I need to get rid of all of those rows and leave just rows of "real" data--long story short.) Specifically, the row after the last row of "real" data is a cell in column A that simply contains the word "Grand". How do I put in code at the end that says "delete all rows at the end of this spreadsheet beginning with this last row that contains just the word 'G...

Can't delete entries from address book
Somehow my Outlook 2003 Address Book has acquired entries that cannot be deleted using the context menu's 'delete' command. Does anyone have any idea of the cause of this and how I can fix the problem? Many thanks. Address book entries are derived from your Contacts folder. Try = deleting them there. --=81 Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. =20 After furious head scratching, Andrew Chalk asked: | Somehow my Outlook 2003 Address Book ...

why my inbox get deleted in orginal mail when i received thru outl
On Thu, 27 Dec 2007 10:44:00 -0800, ravi <ravi@discussions.microsoft.com> wrote: If you have a question about your EMail software please scroll down the list and post it in a discussion group for that software (Outlook? Outlook Express? something else?). This newsgroup is for a different program, Microsoft Access. Use the big textbox to post a comprehensible message when you do, not just the subject line. John W. Vinson [MVP] Ditto what John said but I happen to know the answer to this question so I will post it - Look up "leave e-mail messages on your e-mail ser...

How to merge records into one record by customer's name?
How can I merge repeating records of a customer who has different oders of products? Ist col, Company name, 2nd col cust name, 3rd-10th col Product items Thks, I had tried the help on consolidate, could not fiigure it out. Thks! One way to try .. Assume you have in Sheet1, in A1:E5, the table: Comp Cust Prd#1 Prd#2 Prd#3 ABC XXX 40 50 90 DEF YYY 30 50 20 ABC XXX 50 70 70 DEF YYY 50 30 20 In Sheet2, you have the "master" table below in A1:E2 Comp Cust Prd#1 Prd#2 Prd#3 ABC XXX DEF YYY Put in C2: =SUMPRODUCT((Sheet1!$A$2:$A$5=$A2)*(Sheet1!$B$2:$B$5=$B2),Sheet1!C$2:C$5) Copy C...

SELECT Query Help
Hi, Hoping to get some help modifying the following query that I have... TABLE: NAMES ID, FirstName, LastName TABLE: EMAILS ID,LinkID,Email,LastUpdateDate I have two tables, one of Names, one of Emails. Each person only has one record in the Names table. Each person however, may have multiple email addresses in the Emails table. I want to pull a query that returns a person's name, and the latest email address on file. I am able to successfully pull a full extract that shows names and emails, but I can't figure out how to limit it to the latest email address. So in essence, I am ge...

Open form to ID and add in the record if not there
Hello, I have an issue opening a form to an ID of the record I am currently on. If I am on frmProjects and am adding a typing in a new EndUser from the dropdown in cboEndUser I want to be able to do two things: 1) Add this new EndUser name in the frmEndUserDetails in control source EndUserID (named cboEndUser) once I tab out of it 2) Have this new EndUser nae appear in the frmProjects once I finish adding details about this new End User in frmEndUser. So what happpens is that if I need to enter a new EndUser name in cboEndUser, once i tab out of cboEndUser the frmEndUserDetai...

excel 2010 doesn't delete tmp files when I exit
Hello, I recently installed excel 2010 on a PC, and everytime I exit the program it leaves it's TMP files behind, and never deltes them. I have to delete them every time. I looked into it, and I was told to check anti-virus, and when I deactivated my MS antivirus, it didn't matter. Any ideas? ...

Please add delete action to IMF for information store
Can *anyone* in the Microsoft Exchange team respond to this: Please can the option to *delete* messages be added to the IMF actions for an information store? Why would we want to do this? We are a K12 school and have two Information stores, one for staff, one for students. It is quite acceptable to deliver spam into the junk email folder for staff. It is *not* acceptable to do this for students. Even though the UCE level is getting set correctly (ie the message is correctly classified as spam) the inability to *delete* such messages from the student information store results in adult m...

contacts appear as deleted in my list when they didn't delete me
I have this situation come up every once in a while is anyone else experiencing this? and what is causing the miss labeling? -- Four Generations Of Trust And Betrayal...One Legacy Skywolfe Hi Skywolfe, Just to confirm, how are you identifying them as being deleted? -- Jonathan Kay Microsoft MVP - Windows Live Messenger MSN Messenger/Windows Messenger MessengerGeek Blog: http://www.messengergeek.com Messenger Resources: http://messenger.jonathankay.com (c) 2009 Jonathan Kay - If redistributing, you must include this signature or citation -- "Rage Skywolfe"...

PSTL General Ledger Master Record Trigger
I recently setup a new company, integrated all the existing accounts from another company into the new company, and then setup a GL Master Record Trigger between the two for Accounts only. Since then I've added a number of new accounts and also updated a few. None of the new accounts or updates have been replicated to the other company and I can't figure out why. I've verified that the company stucture in the two companies is the same by checking in both GP and on our server (table SY00300). We're using Professional Services Tools Library 9.0.21. Does anyone have oth...

Getting duplicate records, can't figure out why!
I'm creating a database to track inventory movements for reserve calculation purposes. I start out with two tables, Inv Mov and Inv Bal. From Inv Mov, I create a Query "Initial Movements" as a filter. When I run this query, all looks good. I create a new query, "Transaction Summary" that joins fields "P/N" from table "Inv Bal" and Query "Initial Movements". When I run this second query, every record is duplicated. I can't figure out why, and I'm trying to eliminate this. Here's the SQL: SELECT [Inv Bal Eco].[P/N], ...

Reference previous record
I have a query that lists our parts and their cost. Some parts have 1 record and some parts have 2 records because their cost have changed. How can I have the query compare the previous cost for that part if one exists? Thanks, Jasper On Tue, 20 Apr 2010 15:37:06 -0400, "Jasper Recto" <jrecto99@yahoo.com> wrote: >I have a query that lists our parts and their cost. Some parts have 1 >record and some parts have 2 records because their cost have changed. > >How can I have the query compare the previous cost for that part if one >exists? ...

Delete worksheet
In excel 2002 (SP-2), when I do a Delete<Sheet, it does not give a confirmation. How can I turn on the the delete confirmation ON?? Thanks Madan I've never seen the warning message not show up when I do Edit|delete sheet or rightclick on the worksheet tab and select delete. How are you doing Delete|Sheet? If it's a home grown utility, that warning message could be turned off. Mohan wrote: > > In excel 2002 (SP-2), when I do a Delete<Sheet, it does not give a > confirmation. How can I turn on the the delete confirmation ON?? > > Thanks > Madan -- Da...

auto-updating the auto-updater so 12.0.1 can be installed forces a complete delete and reinstall of office 2008
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: intel Okay - I must confess I never thought that the mac geeks that work for microsoft had any affinity for writing bad code, but i definately found some in the auo-updating system - which after a reinstall didnt recognise that 12.0.1 OR its own update were ready for download - i had to download 12.0.1 as a .dmg and have NO idea how to force the upgrader program to upgrade itself like its supposed to -- because it DID SO ONCE, and as of this moment none of the applications that are updated by that package refect that they have...

How do I record this special transaction: Vodaphone
Hello I own some Vodaphone ADRs. In July they made a mandatory exchange - sadly using the same stock symbol. They exchanged .87 shares for every 1 share. I am using Money 2004 (standard) - how do I record this transaction? -- Leslie ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in th...

H E L P
THE SETUP: - we are running a query with fields from two related tables... tblParent and tblChild... - selecting records on a field in tblParent - now change to Update Query - to update a field in tblChild THE PROBLEM: If there is no tblChild record for a particular tblParent record... none is added. We want Access to add a tblChild record if none exist for any tblParent record. How can we do this? Oh, we are doing this using the Access query grid and not raw SQL or Code. Thanks for any help. Access lacks triggers, so you will not be able to get Access to add a new relaed record ...

Outlook 2007 signature keeps getting deleted
We are in the process of upgrading to Office 2007 Professional. Several users are complaining that their signatures keep getting deleted. Any suggestions? ...

Unable to delete a task request from inbox in outlook
Hi all, Does anyone have an idea how I delete a task request from my inbox. When I try to delete the task request i get the outlook dialog box up, which states. "The task folder could not be found. Could not open the item. Try again." Any help with this would be appreciated. Thanks in advance. ...

Graphics moved, but can't delete paragraph mark
I'm using Word 2003 for PC on Windows XP. I've inherited a large document that I'm trying to reformat. The document has many paragraph marks (some in the middle of paragraphs) that I am unable to select and delete. I believe that they are there because a graphic used to be placed following the paragraph mark, and that graphic has since been moved or deleted. However, I'm not an expert at graphic placement nor is there any way to locate which graphic (if any remaining) might be attached to a particular paragraph mark. As a workaround, I've had to manually move text...

How to delete here and there in a worksheet....
Hi... How can I delete the contains of all unlocked cells in a worksheet in one sweep? I have this worksheet with 6 * 13 * 33 cells scattered around the entire spreadsheet, divided by an unknown number of hidden and locked cells containing formulas vital to the entire spreadsheet. I have hidden the locked cells. I have removed the mark letting me choose locked cells. I cannot mark the whole spreadsheet in order to hit delete. -- Regards Zadig Galbaras (nick) ----- Sub UnLocked_Cells() Dim cell As Range, tempR As Range, rangeToCheck As Range For Each cell In ActiveSheet.Used...

Duplicate records in Outlook
We have a number of instances where there are duplicate records in Outlook contacts being created where there is only a single record in CRM 3.0. We have tried everything we can think of but each time we clean up Outlook contacts, duplicates gradually start to reappear. We have over 80 users of the system - only 3 or 4 are experiencing this issue. Any advice appreciatd Thanks Howard Are they sync'ing their contacts to their mobile devices? Perhaps the mobile device is set to write back to outlook which would create duplicates. Anne Stanton "hlask1@gmail.com" wrote: >...

Cannot delete mail in deleted items
We migrated all of our mailboxes to a new server this weekend. We are having a strange problem today. Nobody can delete anything in there deleted items. It doesn’t give them an error. It just doesn’t delete the item. I’ve also noticed that the “recover deleted items” is grayed out. shift delete will work, but I want to be able to use delete. The new server is running Exchange 2003 sp2. The clients are running Office XP SP3. any ideas? what happens if you right-click on the deleted items folder and select, "Empty deleted items"? -- Susan Conkey [MVP] "jbwerner&...

Delete Timesheet Period that contains actual hours ?
when i try to delete the timesheets periods. some timesheet periods are unable to delete and delete button showing disable. I want to delete all timesheets periods whether they have some actual hours and some have not. how to this . kindly reply me soon Hi Sam, make sure that your periods are not closed. Go to 'Delete Enterprise Objects', select Timesheets and the appropriate period and delete them. This will delete timesheets even with actuals. After deleting them, you can delete periods. Regards Barbara "Sam" <Sam@discussions.microsoft.com&g...