Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 670669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:17:22+00:00 2026-05-14T00:17:22+00:00

I currently have a problem attepting to update a record within my database. I

  • 0

I currently have a problem attepting to update a record within my database. I have a webpage that displays in text boxes a users details, these details are taken from the session upon login. The aim is to update the details when the user overwrites the current text in the text boxes.

I have a function that runs when the user clicks the ‘Save Details’ button and it appears to work, as i have tested for number of rows affected and it outputs 1. However, when checking the database, the record has not been updated and I am unsure as to why.

I’ve have checked the SQL statement that is being processed by displaying it as a label and it looks as so:

UPDATE [users] 
   SET [email] = @email, 
       [firstname] = @firstname, 
       [lastname] = @lastname, 
       [promo] = @promo 
 WHERE [users].[user_id] = 16

The function and other relevant code is:

Sub Page_Load(sender As Object, e As EventArgs)

usernameLabel.text = session.contents.item("UserName")

if usernameLabel.text = "" then

    logoutButton.Visible = False
    loggedInAsLabel.Visible = False

else

    labelGuest.Visible = False
    linkLogin.Visible = False
    linkRegister.Visible = False

end if

emailBox.text = session.contents.item("Email")
firstBox.text = session.contents.item("FirstName")
lastBox.text = session.contents.item("LastName")
promoBox.text = session.contents.item("Promo")


End Sub

Sub Button1_Click(sender As Object, e As EventArgs)

    changeDetails(emailBox.text, firstBox.text, lastBox.text, promoBox.text)

End Sub

Function changeDetails(ByVal email As String, ByVal firstname As String, ByVal lastname As String, ByVal promo As String) As Integer
    Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Documents an"& _
        "d Settings\Paul Jarratt\My Documents\ticketoffice\datab\ticketoffice.mdb"
    Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)

    Dim queryString As String = "UPDATE [users] SET [email]=@email, [firstname]=@firstname, [lastname]=@lastname, "& _
        "[promo]=@promo WHERE ([users].[user_id] = " + session.contents.item("ID") + ")"
    Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
    dbCommand.CommandText = queryString
    dbCommand.Connection = dbConnection

    Dim dbParam_email As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
    dbParam_email.ParameterName = "@email"
    dbParam_email.Value = email
    dbParam_email.DbType = System.Data.DbType.[String]
    dbCommand.Parameters.Add(dbParam_email)

    Dim dbParam_firstname As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
    dbParam_firstname.ParameterName = "@firstname"
    dbParam_firstname.Value = firstname
    dbParam_firstname.DbType = System.Data.DbType.[String]
    dbCommand.Parameters.Add(dbParam_firstname)

    Dim dbParam_lastname As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
    dbParam_lastname.ParameterName = "@lastname"
    dbParam_lastname.Value = lastname
    dbParam_lastname.DbType = System.Data.DbType.[String]
    dbCommand.Parameters.Add(dbParam_lastname)

    Dim dbParam_promo As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
    dbParam_promo.ParameterName = "@promo"
    dbParam_promo.Value = promo
    dbParam_promo.DbType = System.Data.DbType.[String]
    dbCommand.Parameters.Add(dbParam_promo)

    Dim rowsAffected As Integer = 0
    dbConnection.Open
    Try
        rowsAffected = dbCommand.ExecuteNonQuery
    Finally
        dbConnection.Close
    End Try

    labelTest.text = rowsAffected.ToString()

    if rowsAffected = 1 then

    labelSuccess.text = "* Your details have been updated and saved"

    else

    labelError.text = "* Your details could not be updated"

    end if

End Function

Any help would be greatly appreciated.

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:17:23+00:00Added an answer on May 14, 2026 at 12:17 am

    Does your page have a RequiresTransaction property? If so, check that there are no exceptions thrown elsewhere during the request which might cause the transaction to roll back – leaving the data unchanged.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.