VB.net ( 2003 ) & SQL 2005
Thank you for all the help in navigating through the dataset using the
CurrencyManager.
However im now stuck on the next part , Updating, and addind records.
how can i
1. Client_RS.HasChanges(DataRowState.Modified), update the dataset with the
amended data and
pass that through to the SQL server. Can this be done through the dataset
or will i need
to use a direct update SQL command and then reload the dataset?
2. Add a new record?
3. Cancel any changes and revert back to the origional data before the
changes are comited
any simple examples would be very usefull in helping to understand how the
macanics work
Thank you in advance
Private Manager As CurrencyManager
Private Client_RS As New DataSet
' Load the DataSet with the client admin recordset
Private Sub LoadDataSet()
' Try to retrieve the records
Try
Client_RS = GetSQLDataSet("EXEC Bossdata.dbo.SQL2005_ADMINRS")
Try
LoadControls(0)
BindControls()
Catch ex As Exception
MsgBox("Error Seeking 1st Record " & ex.Message)
End Try
Catch ex As Exception
' Pit In error trapping Here
MsgBox("Error Generating Recordset " & ex.Message)
End Try
End Sub
Protected Sub BindControls()
' Bind the controls to the dataset
'Licence
strLicence.DataBindings.Add("text", Client_RS,
"TBL_ClientAdmin.Licence")
' Company Name
strCompanyName.DataBindings.Add(New Binding("Text", Client_RS,
"TBL_ClientAdmin.CompanyName"))
' Set the Manager position to the current record
Manager = Me.BindingContext(Client_RS, "TBL_ClientAdmin")
End Sub
' Check For Any Data Changes
Private Sub ValidateChanges()
If Client_RS.HasChanges(DataRowState.Modified) Then
' MsgBox(" Changed ")
Else
' MsgBox(" Not Changed ")
End If
End Sub