[2005] Changes not making it to dataset
Using the following to fill dataset:
vb.net Code:
jobDA = New OleDb.OleDbDataAdapter("SELECT * FROM jobs WHERE jobs.jobno = " & JobNo, con)
jobDA.Fill(jobDS)
Then adding databinding to textbox in form:
vb.net Code:
Dim tbl As DataTable = jobDS.Tables(0)
Me.txtOrderNo.DataBindings.Add("text", tbl, "OrderNo")
When i change the value of txtOrderNo jobDS.HasChanges stays false.
This is code which i have used before and worked fine. Any ideas?
TIA
Re: [2005] Changes not making it to dataset
Are you ending the editing session? To do so you would have to leave the TextBox. You should use a BindingSource between the table and the control, then you can just call its EndEdit method to commit any pending changes.
Re: [2005] Changes not making it to dataset
yes i am leaving the textbox, i'm checking jobds.haschanges on leave of the form.
Do you think using a bindingsource is a better way of doing things? could you point to an example of how to use it, have just had a go but couldn't work it.
Thanks
Re: [2005] Changes not making it to dataset
I use a BindingSource at least 99 times out of 100 when data-binding. An example of how to use it? The class documentation is where you should be looking first on all occasions.
Re: [2005] Changes not making it to dataset
Thanks jm, yea did check the docco.
Thing i cant figure out is how to use it with controls that dont have a datasource property, ie a textbox or label. All the examples i can find are for datagrids or list boxes. Can i have a clue :o
Re: [2005] Changes not making it to dataset
Even if a control supports complex data-binding via a DataSource property, all controls support simple data-binding to a single property via their DataBindings collection. You can bind a property to any object that way, including a BindingSource.