M
MadCrazyNewbie
Hi group,
Could i please ask somebodys opinion? Below is my code for my database
project. Would this seem like the best way to do it? I know there is many
ways to do it, and after all the help on this NG this is how far i`ve got.
Sorry i`ve asked so many questions, i just don`t want to start doing it
wrong from the start.
Anybody like to comment?
Many Many Thanks
MCN
Private Sub btnPasswordListsDelete_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsDelete.Click
If (Me.BindingContext(dsPasswordList, "PasswordList").Count > 0)
Then
Me.BindingContext(dsPasswordList,
"PasswordList").RemoveAt(Me.BindingContext(dsPasswordList,
"PasswordList").Position)
End If
End Sub
Private Sub btnPasswordListsAdd_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsAdd.Click
Try
Me.BindingContext(dsPasswordList,
"PasswordList").EndCurrentEdit()
Me.BindingContext(dsPasswordList, "PasswordList").AddNew()
Catch eEndEdit As System.Exception
System.Windows.Forms.MessageBox.Show(eEndEdit.Message)
End Try
End Sub
Private Sub btnPasswordListsCancel_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsCancel.Click
Me.BindingContext(dsPasswordList,
"PasswordList").CancelCurrentEdit()
End Sub
Private Sub btnPasswordListsUpdate_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsUpdate.Click
Try
Dim objDataSetChanges As Excellence.NET.dsPasswordList = New
Excellence.NET.dsPasswordList()
Me.BindingContext(dsPasswordList,
"PasswordList").EndCurrentEdit()
objDataSetChanges = CType(dsPasswordList.GetChanges,
Excellence.NET.dsPasswordList)
If (Not (objDataSetChanges) Is Nothing) Then
Try
If (Not (dsPasswordList) Is Nothing) Then
Me.odcPasswordLists.Open()
odaDepartments.Update(dsPasswordList)
odaPasswordList.Update(dsPasswordList)
End If
Catch updateException As System.Exception
Throw updateException
Finally
Me.odcPasswordLists.Close()
End Try
End If
dsPasswordList.Merge(objDataSetChanges)
dsPasswordList.AcceptChanges()
Catch eUpdate As System.Exception
Throw eUpdate
End Try
Try
Catch eUpdate As System.Exception
System.Windows.Forms.MessageBox.Show(eUpdate.Message)
End Try
End Sub
Could i please ask somebodys opinion? Below is my code for my database
project. Would this seem like the best way to do it? I know there is many
ways to do it, and after all the help on this NG this is how far i`ve got.
Sorry i`ve asked so many questions, i just don`t want to start doing it
wrong from the start.
Anybody like to comment?
Many Many Thanks
MCN
Private Sub btnPasswordListsDelete_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsDelete.Click
If (Me.BindingContext(dsPasswordList, "PasswordList").Count > 0)
Then
Me.BindingContext(dsPasswordList,
"PasswordList").RemoveAt(Me.BindingContext(dsPasswordList,
"PasswordList").Position)
End If
End Sub
Private Sub btnPasswordListsAdd_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsAdd.Click
Try
Me.BindingContext(dsPasswordList,
"PasswordList").EndCurrentEdit()
Me.BindingContext(dsPasswordList, "PasswordList").AddNew()
Catch eEndEdit As System.Exception
System.Windows.Forms.MessageBox.Show(eEndEdit.Message)
End Try
End Sub
Private Sub btnPasswordListsCancel_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsCancel.Click
Me.BindingContext(dsPasswordList,
"PasswordList").CancelCurrentEdit()
End Sub
Private Sub btnPasswordListsUpdate_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPasswordListsUpdate.Click
Try
Dim objDataSetChanges As Excellence.NET.dsPasswordList = New
Excellence.NET.dsPasswordList()
Me.BindingContext(dsPasswordList,
"PasswordList").EndCurrentEdit()
objDataSetChanges = CType(dsPasswordList.GetChanges,
Excellence.NET.dsPasswordList)
If (Not (objDataSetChanges) Is Nothing) Then
Try
If (Not (dsPasswordList) Is Nothing) Then
Me.odcPasswordLists.Open()
odaDepartments.Update(dsPasswordList)
odaPasswordList.Update(dsPasswordList)
End If
Catch updateException As System.Exception
Throw updateException
Finally
Me.odcPasswordLists.Close()
End Try
End If
dsPasswordList.Merge(objDataSetChanges)
dsPasswordList.AcceptChanges()
Catch eUpdate As System.Exception
Throw eUpdate
End Try
Try
Catch eUpdate As System.Exception
System.Windows.Forms.MessageBox.Show(eUpdate.Message)
End Try
End Sub