Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim con As SqlConnection
- Dim ds As DataSet
- Dim ada As SqlDataAdapter
- Dim dr() As DataRow
- Dim newRow As DataRow
- Dim myInput As frmInput = New frmInput
- Dim user, pass As String
- myInput.msg("Alerta", "Nombre de usuario: ")
- user = myInput.txtInput.Text
- myInput.Dispose()
- If user.Length > 0 Then
- myInput = New frmInput
- myInput.msg("Alerta", "Contraseña: ")
- pass = myInput.txtInput.Text
- If pass.Length > 0 Then
- con = New SqlConnection
- con.ConnectionString = "Data Source=.\SQLEXPRESS; Initial Catalog = codevcomedor; trusted_connection = true"
- con.Open()
- ds = New DataSet
- ada = New SqlDataAdapter("select * from cliente_web", con)
- Dim cmd As SqlCommandBuilder = New SqlCommandBuilder(ada)
- ada.Fill(ds, "cliweb")
- dr = ds.Tables("cliweb").Select("cli_login = '" + user + "'")
- If dr.Count = 0 Then
- newRow = ds.Tables("cliweb").NewRow
- newRow.Item("cli_login") = user
- newRow.Item("cli_tipo") = "2"
- newRow.Item("cli_pass") = pass
- ds.Tables("cliweb").Rows.Add(newRow)
- ada.Update(ds, "cliweb")
- frmMsgBox.msg("Correcto", "Usuario creado")
- Else
- frmMsgBox.msg("Error", "Usuario existente")
- End If
- Else
- frmMsgBox.msg("Error", "Password obligatorio")
- End If
- End If
Add Comment
Please, Sign In to add comment