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

  • SEARCH
  • Home
  • 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 8433283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:20:42+00:00 2026-06-10T06:20:42+00:00

I have to tabels in an access db User userid username useractiv Userinfo userinfoid

  • 0

I have to tabels in an access db

User

  • userid
  • username
  • useractiv

Userinfo

  • userinfoid
  • userrealname
  • userphone

i then get the info from some asp:text fields to the update handler, i know how to do this for one table but not for 2.

normally i use this

    Dim strSQL As String = ""
    strSQL = "" & _
    "UPDATE Userinfo " & _
    "SET userrealname = @therealname, userphone = @theuserphone " & _
    "WHERE userinfoid =" & Session("theeditid") & ""

    Using connection As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("ConnStr").ConnectionString)
        Using updatecmd As OleDbCommand = New OleDbCommand(strSQL, connection)
            updatecmd.CommandType = CommandType.Text
            updatecmd.Parameters.AddWithValue("@therealname", OleDbType.VarChar).Value = TextBox1.Text
            updatecmd.Parameters.AddWithValue("@theuserphone", OleDbType.VarChar).Value = CKEditor1.Text
            Try
                updatecmd.Connection.Open()
                Dim i As Integer = CInt(updatecmd.ExecuteNonQuery())
                If i = 0 Then
                    Session("editsucces") = "NoMatch" 'no rows were updated because none matched the criteria
                End If
            Catch ex As Exception
                Session("editsucces") = "DBerror" 'Something went wrong, such as the database was unavailable
            End Try
        End Using
    End Using

So my question is now, how can i add the fields from the user tabel !?
The user.userid is the same number as in userinfo.userinfoid.

EDIT……..EDIT……..EDIT…….EDIT……….EDIT………EDIT……….EDIT

So this code is ok, or do u recoment that i changes some of it !?

Dim strSQL As String = ""
    strSQL = "" & _
    "UPDATE Users INNER JOIN Userinfo ON Users.UserID = Userinfo.UserID " & _
    "SET Users.Username = [@uname], Users.Password = [@upass], Users.UserActiv = [@uactiv], Userinfo.UserRealName = [@urname], Userinfo.UserEmail1 = [@umail], Userinfo.UserDOB = [@udob], Userinfo.UserPhone1 = [@uphone1], Userinfo.UserPhone2 = [@uphone2], Userinfo.UserPhone3 = [@uphone3], Userinfo.UserYear = [@uyear], Userinfo.UserSick = [@usick] " & _
    "WHERE Users.UserID = [@uid]"

    Using connection As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("ConnStr").ConnectionString)
        Using updatecmd As OleDbCommand = New OleDbCommand(strSQL, connection)
            updatecmd.CommandType = CommandType.Text
            updatecmd.Parameters.AddWithValue("@uname", OleDbType.VarChar).Value = userinput1.Text
            updatecmd.Parameters.AddWithValue("@upass", OleDbType.VarChar).Value = userinput2.Text
            updatecmd.Parameters.AddWithValue("@uactiv", OleDbType.VarChar).Value = "Y"
            updatecmd.Parameters.AddWithValue("@urname", OleDbType.VarChar).Value = userinput3.Text
            updatecmd.Parameters.AddWithValue("@umail", OleDbType.VarChar).Value = userinput4.Text
            updatecmd.Parameters.AddWithValue("@udob", OleDbType.VarChar).Value = userinput5.Text
            updatecmd.Parameters.AddWithValue("@uphone1", OleDbType.VarChar).Value = userinput6.Text
            updatecmd.Parameters.AddWithValue("@uphone2", OleDbType.VarChar).Value = userinput7.Text
            updatecmd.Parameters.AddWithValue("@uphone3", OleDbType.VarChar).Value = userinput8.Text
            updatecmd.Parameters.AddWithValue("@uyear", OleDbType.VarChar).Value = userinput9.Text
            updatecmd.Parameters.AddWithValue("@usick", OleDbType.VarChar).Value = usertextarea.Text
            Try
                updatecmd.Connection.Open()
                Dim i As Integer = CInt(updatecmd.ExecuteNonQuery())
                If i = 0 Then
                    Session("editsucces") = "NoMatch" 'no rows were updated because none matched the criteria
                End If
            Catch ex As Exception
                Session("editsucces") = "DBerror" 'Something went wrong, such as the database was unavailable
            End Try
        End Using
    End Using

    Response.Redirect("default.aspx", False)
  • 1 1 Answer
  • 0 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-06-10T06:20:43+00:00Added an answer on June 10, 2026 at 6:20 am

    It should be possible to create a join to update both tables. For example:

    sSQL = "UPDATE [User] INNER JOIN userinfo " _
    & "ON User.UserID = userinfo.userinfoid SET " _
    & "[User].UserName = [uname], userinfo.userrealname = [urname] " _
    & "WHERE [User].UserID = [uid]"
    
    cmd.ActiveConnection = cn
    cmd.CommandText = sSQL
    cmd.CommandType = adCmdText
    cmd.Parameters.Append cmd.CreateParameter( _
        "uname", adVarChar, adParamInput, 50, "user name")
    cmd.Parameters.Append cmd.CreateParameter( _
        "urname", adVarChar, adParamInput, 50, "user real name")
    cmd.Parameters.Append cmd.CreateParameter( _
        "uid", adInteger, adParamInput, , 2)
    cmd.Execute
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose that I have 2 tables: [User] - UserID - Username [Task] - TaskID
I have tables like this: tblUsers int UserID string UserName tblUsersInRoles int UserID int
I just changed from Access to mySQL. I have a few tables, called Veranstaltung
I have three tables to define users: USER: user_id (int), username (varchar) USER_METADATA_FIELD: user_metadata_field_id
Well guys, I have three tables here, menu, user and access. For simplifying let's
I'm using the asp.net login control for user authentication. I also have the userID
I have a user table that controls access to a website. We currently have
Have 2 tables in Access 2007, both lists of certain tasks to be accomplished.
Say we have two tables in an MS Access db: Service Users: | ID
I have an access database with these tables: - sequences: it describes the sequences

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.