dcsimg
Results 1 to 8 of 8

Thread: Update Login Details to Database

  1. #1

    Thread Starter
    Addicted Member ashveen's Avatar
    Join Date
    Sep 2013
    Location
    Sri Lanka
    Posts
    141

    Update Login Details to Database

    Name:  C_P Form.JPG
Views: 328
Size:  49.4 KB


    Above shows my Change Password Form.
    It shows the user type, username and passwords stored in my database.
    I want to know how to add details from this form to the database (Add New Button)
    and also want to know how to delete them (Delete Button)

    here is my code, I tried a few of own but it didnt work. pls help me
    Code:
    Public Class frm_Change_Password
    
        Private Sub frm_Change_Password_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move, Me.SizeChanged, Me.Shown
            Dim r As Rectangle = Me.Bounds
            r.Inflate(35, 35)
            frm_BG1.Bounds = r
        End Sub
        Private Sub Username_PasswordBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Me.Validate()
            Me.Username_PasswordBindingSource.EndEdit()
            Me.TableAdapterManager.UpdateAll(Me.Username_PasswordDataSet)
        End Sub
    
        Private Sub frm_Change_Password_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.Owner = frm_BG1
            'TODO: This line of code loads data into the 'U_PDataSet.Usernames_Passwords' table. You can move, or remove it, as needed.
            Me.Username_PasswordTableAdapter.Fill(Me.Username_PasswordDataSet.Username_Password)
            IDTextBox.Enabled = False
            UserTypeTextBox.Enabled = False
            UsernameTextBox.Enabled = False
            PasswordTextBox.Enabled = False
        End Sub
    
        Private Sub KryptonButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton3.Click
            Me.Username_PasswordBindingSource.AddNew()
            IDTextBox.Enabled = True
            UserTypeTextBox.Enabled = True
            UsernameTextBox.Enabled = True
            PasswordTextBox.Enabled = True
        End Sub
    
        Private Sub KryptonButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton4.Click
            Me.Validate()
            Me.Username_PasswordBindingSource.EndEdit()
            Me.TableAdapterManager.UpdateAll(Me.Username_PasswordDataSet)
        End Sub
    
        Private Sub KryptonButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton5.Click
            Me.Username_PasswordBindingSource.RemoveCurrent()
        End Sub
    End Class

  2. #2

    Thread Starter
    Addicted Member ashveen's Avatar
    Join Date
    Sep 2013
    Location
    Sri Lanka
    Posts
    141

    Re: Update Login Details to Database

    Name:  dataset.JPG
Views: 159
Size:  143.4 KB

  3. #3

    Thread Starter
    Addicted Member ashveen's Avatar
    Join Date
    Sep 2013
    Location
    Sri Lanka
    Posts
    141

    Re: Update Login Details to Database

    Can someone PLEASE! PLEASE!! PLEASE!!! help me on this!!!!!!!!!!!

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    Re: Update Login Details to Database

    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  5. #5
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,363

    Re: Update Login Details to Database

    I don't see anything wrong, but you should give the controls more meaningful names. What happens when you press Add or Save or Delete. Is data in other parts of your program being saved or updated?

  6. #6

    Thread Starter
    Addicted Member ashveen's Avatar
    Join Date
    Sep 2013
    Location
    Sri Lanka
    Posts
    141

    Re: Update Login Details to Database

    Quote Originally Posted by wes4dbt View Post
    I don't see anything wrong, but you should give the controls more meaningful names. What happens when you press Add or Save or Delete. Is data in other parts of your program being saved or updated?
    When I press Add, I could Add a new login user by filling the above form. To confirm that there is a new user, I click the Save button. Delete button deletes a user.
    Whatever I add or delete goes and update in my backend database (Ms Access)
    No i still haven't designed the other forms.
    I want the DeleteCommand's and UpdateCommand's CommandText queries to be filled automatically like the others (InsertCommand and SelectCommand)??
    Thank You!

  7. #7

    Thread Starter
    Addicted Member ashveen's Avatar
    Join Date
    Sep 2013
    Location
    Sri Lanka
    Posts
    141

    Re: Update Login Details to Database

    Quote Originally Posted by dunfiddlin View Post
    I clicked your google links, but I couldn't find anything relevant to my project as shown above.
    I too did a lot of google searching but I couldn't find anything.

  8. #8
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,363

    Re: Update Login Details to Database

    When I asked what happens when you press save or add or delete, I meant do you get an error or does nothing happen. I don't know why your tableadapter doesn't have all the commands. I would first try deleting that tableadapter and then add a new one with the same name. See if that solves the problem. Are the textboxes bound to the bindingsource. Is there any other relevant code? If so, post it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width