Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click
- Dim strSelect As String = ""
- Dim strFirstName As String = ""
- Dim strLastName As String = ""
- Dim strAddress As String = ""
- Dim strCity As String = ""
- Dim strState As String = ""
- Dim strZip As String = ""
- Dim strPhoneNumber As String = ""
- Dim strEmail As String = ""
- Dim intRowsAffected As Integer
- Dim cmdUpdate As OleDb.OleDbCommand
- If Validation() = True Then
- ' open database
- If OpenDatabaseConnectionSQLServer() = False Then
- ' No, warn the user ...
- MessageBox.Show(Me, "Database connection error." & vbNewLine &
- "The application will now close.",
- Me.Text + " Error",
- MessageBoxButtons.OK, MessageBoxIcon.Error)
- Me.Close()
- End If
- If Validation() = True Then
- strFirstName = txtFirstName.Text
- strLastName = txtLastName.Text
- strAddress = txtAddress.Text
- strCity = txtCity.Text
- strState = txtState.Text
- strZip = txtZip.Text
- strPhoneNumber = txtPhoneNumber.Text
- strEmail = txtEmail.Text
- strSelect = "Update TGolfers Set strFirstName = '" & strFirstName & "', " & "strLastName = '" & strLastName &
- "', " & "strAddress = '" & strAddress & "', " & "strCity = '" & strCity & "', " &
- "strState = '" & strState & "', " & "strZip = '" & strZip & "', " &
- "strPhoneNumber = '" & strPhoneNumber & "', " & "strEmail = '" & strEmail & "', " &
- "intShirtSizeID = '" & cboShirtSizes.SelectedValue.ToString & "' " &
- "intGenderID = '" & cboGenders.SelectedValue.ToString & "' " &
- "Where intGolferID = " & cboGolfers.SelectedValue.ToString
- MessageBox.Show(strSelect)
- cmdUpdate = New OleDb.OleDbCommand(strSelect, m_conAdministrator)
- intRowsAffected = cmdUpdate.ExecuteNonQuery()
- If intRowsAffected = 1 Then
- MessageBox.Show("Update successful")
- Else
- MessageBox.Show("Update failed")
- End If
- CloseDatabaseConnection()
- frmManageGolfers_Load(sender, e)
- End If
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement