Visual Studio .NET - Run Code for InsertCommand

Asked By David on 07-Mar-11 03:18 AM


I have got the ( BindingNavigatorAddNewItem ) button on the binding navigator bar I need the code to make this run the insertcommand from my DatasetTableadapter and insert the selected Prikey (number row selected) in Datagridview
If I click on it now it just inserts a blank line what I need it to do is insert from Table 1 to Table 2 like it does when I run the query in Query Builder .
How do I code this to run from ( BindingNavigatorAddNewItem ) button .
The code below runs delete ok with no problems

Private Sub BindingNavigatorDeleteItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem1.Click

If (Me.Validate() And Not (COURSEBindingSource Is Nothing)) Then

If (MsgBox("Delete?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes) Then

COURSEBindingSource.RemoveCurrent()

COURSEBindingSource.EndEdit()

Me.TableAdapterManager.UpdateAll(Me.CourseDataSet1)

Thanks David

Asked By David on 13-Mar-11 04:29 PM
Hi Sharma

Sorry for the long delay I have tried all methods and am still lost none of them will work.

I have made a new sql query which again works perfect when I run it in Query Builder but I dont seem to be able to code this to work from Datagridview selecting the prikey Number and row from the Datagrid
Any Ideas this has had me beaten for ages (bring back Access its easier)

Thanks

David