Guest User

Untitled

a guest
Aug 10th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. Dim con As SqlConnection
  2. Dim ds As DataSet
  3. Dim ada As SqlDataAdapter
  4. Dim dr() As DataRow
  5. Dim newRow As DataRow
  6. Dim myInput As frmInput = New frmInput
  7. Dim user, pass As String
  8.  
  9. myInput.msg("Alerta", "Nombre de usuario: ")
  10. user = myInput.txtInput.Text
  11. myInput.Dispose()
  12.  
  13. If user.Length > 0 Then
  14. myInput = New frmInput
  15. myInput.msg("Alerta", "Contraseña: ")
  16. pass = myInput.txtInput.Text
  17.  
  18. If pass.Length > 0 Then
  19.  
  20. con = New SqlConnection
  21. con.ConnectionString = "Data Source=.\SQLEXPRESS; Initial Catalog = codevcomedor; trusted_connection = true"
  22. con.Open()
  23.  
  24. ds = New DataSet
  25. ada = New SqlDataAdapter("select * from cliente_web", con)
  26. Dim cmd As SqlCommandBuilder = New SqlCommandBuilder(ada)
  27. ada.Fill(ds, "cliweb")
  28.  
  29.  
  30. dr = ds.Tables("cliweb").Select("cli_login = '" + user + "'")
  31.  
  32.  
  33. If dr.Count = 0 Then
  34. newRow = ds.Tables("cliweb").NewRow
  35.  
  36. newRow.Item("cli_login") = user
  37. newRow.Item("cli_tipo") = "2"
  38. newRow.Item("cli_pass") = pass
  39.  
  40. ds.Tables("cliweb").Rows.Add(newRow)
  41.  
  42. ada.Update(ds, "cliweb")
  43.  
  44. frmMsgBox.msg("Correcto", "Usuario creado")
  45. Else
  46. frmMsgBox.msg("Error", "Usuario existente")
  47. End If
  48. Else
  49. frmMsgBox.msg("Error", "Password obligatorio")
  50. End If
  51.  
  52.  
  53. End If
Add Comment
Please, Sign In to add comment