Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Updating SQL Join via DATASET

matthew5matthew5 Posts: 1Member
I need some help, I have been at this for a few days...
I have a datagridview that I am populating with an SQL JOIN with the following stored procedure...

CREATE PROCEDURE sp_company_GRIDVIEW_Iuserid_companyid
@companytypenumber int,
@iuserid int
AS
Select tblcompany.CompanyName as [Company Name],
tblcompanytypes.Companytype as [Group Name],
tblcompany.phoneNumber as [Phone Number],
tblcompany.Altphone as [Alternate Phone],
tblcompany.Address,
tblcompany.city,
tblcompany.EmailAddress as [Email Address]
From tblcompany INNER JOin tblcompanytypes ON
tblcompany.companytypeNumber = tblcompanytypes.companytypenumber
Where tblcompanytypes.IUSERID = @iuserid And tblcompanytypes.companytypenumber = @companytypenumber
GO

The results are successfully returned into the datagridview, and it works great,
However I would like to implement the functionality to update, insert, and delete from the datagrid.

To start with the following code, saves changes to my dataset, with the cellendedit event of the datagrid with following..

Private Sub dgcompanies_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgcompanies.CellEndEdit
If Me.PersDB01DataSet.HasChanges Then
Me.PersDB01DataSet.AcceptChanges()

End If
End Sub

There is a save button, that I want to update persdb01dataset to the datasource.
What is the best way to do this? I am really stuck and in need of some help.
Any help is much appreciated, thank you very much.


Sign In or Register to comment.