Roger
Sorry, looking back on my orginal question it seems to vague. Not only does the form contain BookingsBindingSource, but it also has a table adapter called BookingsTableAdapter and a dataset simply known as DataSet. I also have a control called BookingsBindingNavigator. All these controls were preconfigured as I dragged and dropped them from the datasource window onto the form therefore creating the navigation bar along the top of the form and creating the fields in the form of textboxes. Running the program works great with the app communicating with the SQL database and updating any changed fields.
The textboxes come preconfigured as well with databinding. Thats all good and well but I have replaced a textbox with a datetimepicker control and i want to databind this to the 'date' column on my SQL database. See my below code:
Garry
Main Topics
Browse All Topics





by: SanclerPosted on 2008-02-23 at 15:22:05ID: 20967274
A BindingSource is just one link in the chain between a Control and a DataBase.
It's purpose is to link some property or value of a control (or other class) to a DataSource. A DataSource is something INTERNAL to the Application - usually a DataTable (or a List of some sort, although it can be a Type). That DataTable will be "linked" to the DataBase which is EXTERNAL to the Application - in the sense that it gets its data from and can return data to the DataBase - by a TableAdapter or DataAdapter or DataReader. Those, in turn, use a Connection to pass data back and forth between the external DataBase and the internal DataTable.
What all that means is that you can't just "use the bindingsource to bind that variable to the SQL database". There will need to be other links in the chain: I assume there are, but we need to know what they are. What is the DataSource of the BookingsBindingSource? A DataTable called Bookings? The value from your DateTimePicker1 would normally go in that, and that would normally happen by you binding the DateTimePicker1 to that DataTable with the BindingSource rather than you putting DateTimePicker1.Value into a separate variable. And then how does that DataSource (whatever it is) originally get its data? If it's with a TableAdapter then calling BindingSource.EndEdit and TableAdapter.Update will probably be enough to get the value back to the DataBase.
So, unless that is enough to get you going, can you please tell us some more details about your data set-up and your controls?
Roger