By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,511 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

the source code runs well on the accounts' sub-window but not on the users' one

fridrai
P: 9
Hi every body
i'm developping a windows form application with vb.net language and mysql for database, about accounts managing
on the first sub-window users, the customer asks the administrator for gatting a new account by filling a form
on the second sub-window, the addministrator assigns for this user a login and a password for authentication
accounts sub-window on which the administrator assigns login & password works very well and when i control the database i really find it updated either by a new added account or by updating a yet existing one, and here is its code:
acconut code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Butnmodif_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butnmodif.Click
  2. sql = "update account set name ='" & cmbxiduser.Text & "', privilege='" & cmbxpriv.Text & "', login='" & txtlogin.Text & "' , password='" & txtpswd.Text & "', Secret_Question='" & txtsecretq.Text & "', Secret_Answer= '" & txtsecretan.Text & "', email='" & txtemail.Text & "',accstatus= '" & cmbxstate.Text & "' where login = '" & txtlogin.Text & "'"
  3. cmd = New MySqlCommand(sql)
  4. dataadapt = New MySqlDataAdapter(cmd)
  5. datset = New DataSet
  6. cmd.Connection() = cn
  7. cmd.ExecuteNonQuery()
  8. txtemail.Text = ""
  9. txtlogin.Text = ""
  10. txtpswd.Text = ""
  11. txtsecretan.Text = ""
  12. txtsecretq.Text = ""
  13. cmbxiduser.Text = ""
  14. cmbxpriv.Text = ""
  15. ButnNew.Enabled = True
  16. ButtnSave.Enabled = False
  17. End Sub
  18.  
and it works well
contrariwise, the
parcontre, la sub-window user through which a new user inserts his own data, do not work, and here is its code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Butnmodif_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butnmodif.Click
  2. sql = "update user set maritalstatus ='" & cmbxmaritstat.Text & "', sex='" & cmbxsex.Text & "', name='" & txtname.Text & "' , phonenumber='" & txtphone.Text & "', shortname='" & txtshrtname.Text & "', Secret_Question='" & txtsecretq.Text & "', Secret_Answer= '" & txtsecretan.Text & "', email='" & txtEmail.Text & "', country= '" & cmbxgovern.Text & "', address='" & txtadress.Text & "' where name= '" & txtname.Text & "'"
  3. cmd = New MySqlCommand(sql)
  4. dataadapt = New MySqlDataAdapter(cmd)
  5. datset = New DataSet
  6. cmd.Connection() = cn
  7. cmd.ExecuteNonQuery()
  8. txtEmail.Text = ""
  9. txtname.Text = ""
  10. txtshrtname.Text = ""
  11. txtphone.Text = ""
  12. txtsecretan.Text = ""
  13. txtsecretq.Text = ""
  14. txtadress.Text = ""
  15. cmbxsex.Text = ""
  16. cmbxmaritstat.Text = ""
  17. cmbxgovern.Text = ""
  18. ButnNew.Enabled = True
  19. ButtnSave.Enabled = False
  20.  
  21. End Sub 
  22.  
would you like to tell me what's my mistake on the users subwindow?
and let me express my gratitude in advance
Jun 19 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.