Bindingsource and writing to database

pachjo

Member
Joined
Dec 27, 2006
Messages
23
I have set a combobox as follows:

Code:
  set the bindings for the transaction description combobox

   Me.cboTransDescription.DataSource = glb_dbTransactionDescBinding

   Me.cboTransDescription.DisplayMember = "tran_description"

   Me.cboTransDescription.ValueMember = "tran_id"
This successfully populates the combobox and also allows me to add items which appear in the combobox.

I want to be able to delete the selected item in the combobox and found on this site that one should use a bindingsource to do so which I did and it does get removed from the combobox but I have found that neither adding or deleting affects the actual database.

Here is how I setup the bindingsource:

Code:
glb_taTransactionDesc.Fill(glb_dtTransactionDesc)

glb_dbTransactionDescBinding.DataSource = glb_dtTransactionDesc
and here is how I delete a record from the combobox but does not affect the database:

Code:
glb_dbTransactionDescBinding.Remove(glb_dbTransactionDescBinding.Current)

glb_taTransactionDesc.Update(glb_dtTransactionDesc)
Have I lost the plot and missed something important?

Thanks
 
Back
Top