Updating SQL table with form variable

vb0777

New member
Joined
Jul 19, 2007
Messages
1
Programming Experience
3-5
I have created a windows form to update data in a SQL table using a data grid view. On the table adapter I am using the option to generate, insert, update and delete, statements based on the select statement. Everything is working fine I can do all of these things, but for one field in the table I would like to pass a variable from the form to the table. In other words When I create a new row there is a field that I would like to have automatically filled in with a variable from the form. Does anyone know how to do this?
 
I have created a windows form to update data in a SQL table using a data grid view. On the table adapter I am using the option to generate, insert, update and delete, statements based on the select statement. Everything is working fine I can do all of these things, but for one field in the table I would like to pass a variable from the form to the table. In other words When I create a new row there is a field that I would like to have automatically filled in with a variable from the form. Does anyone know how to do this?

Erm.. The only real way I can think to do this is to attach an event handler that fires when the BindingSource is AddingNew, and this event handler will set the Dataset.MyDataTable.MyXXXColumn.DefaultValue
 
Alternately, every time that variable changes, you should update the dataset.MyDataTable.MyXXXColumn.DefaultValue
 
Back
Top