how to use dataset and data class to select insert update fill the tavle in sql2008

Posted by Shanky11 under ASP.NET on 2/26/2013 | Points: 10 | Views : 1083 | Status : [Member] | Replies : 0
i have created a dataset and data class
how can i use this to select,insert update delete and fill like this i have created two foe selct and insert
now i want it for delete and update
---------------------i m pasting below my code---------
Public Class ContactsDataClass

Public ContactsDS As ContactsDataSet
Private eContactMTableAdapter As ContactsDataSetTableAdapters.ContactMTableAdapter

Public Sub New()
Try
ContactsDS = New ContactsDataSet
eContactMTableAdapter = New ContactsDataSetTableAdapters.ContactMTableAdapter
Catch ex As Exception
Throw ex
End Try
End Sub

Public Sub FetchContactDataTable()
Try
eContactMTableAdapter.FillContactM(ContactsDS.ContactM)
Catch ex As Exception

End Try
End Sub

Public Sub Commit()
Insert()

End Sub

Private Sub Insert()
If ContactsDS.ContactM.GetChanges(DataRowState.Added) IsNot Nothing Then
eContactMTableAdapter.Update(ContactsDS.ContactM.GetChanges(DataRowState.Added))
End If
End Sub
Public Sub update()
eContactMTableAdapter.Update (ContactsDS .ContactM
End Sub

End Class




Responses

(No response found.)

Login to post response