Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. vb.net

vb.net

Scheduled Pinned Locked Moved Visual Basic
csharpdotnetquestion
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ago2486
    wrote on last edited by
    #1

    j'ai une base de donnée Admin et une autre PersonneActive et je souhaiterais recuperer les info dela table Admin pour l'inserer dans la table PersonneActive mais mon soucis c'est qu'il s'enregistre duex et je ne c'est pourquoi.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Try
    If TxtUser.Text = Nothing Or TxtPassWord.Text = Nothing Then
    MsgBox("Veuillez renseigner tous les champs", MsgBoxStyle.Exclamation)
    Else
    If cnx.State = ConnectionState.Closed Then
    cnx.Open()
    End If

                'VERIFER LES ENREGISTREMENTS DANS LA BASE DE DONNEE
                'cnx.Open()
                Dim searchQuery As String = "select count(\*) from Admin WHERE RefAdmin=? and MotDePasse=?"
                Dim Command As New OleDbCommand(searchQuery, cnx)
    
                Command.Parameters.AddWithValue("@1", OleDbType.VarChar).Value = TxtUser.Text
                Command.Parameters.AddWithValue("@2", OleDbType.VarChar).Value = TxtPassWord.Text
    
                Dim count = Convert.ToInt32(Command.ExecuteScalar())
    
                If (count > 0) Then
                    MsgBox("Mot de passe validé avec succès'" & TxtUser.Text & "'", MsgBoxStyle.Information)
                    'DECLARATION DES VARIABLES 
                    Dim motpass, nom, dateactive As String
                    motpass = TxtPassWord.Text
                    nom = TxtUser.Text
                    dateactive = DateAndTime.Now()
                    Dim insert2 As String = "INSERT INTO \[PersonneActive\] (\[MotPasseActive\], \[NomActive\], \[DateActive\]) VALUES (@motpass, @nom, @dateactive)"
                    Using cmd As New OleDbCommand(insert2, cnx)
                        'cmd.Parameters.AddWithValue("", 1)
                        cmd.Parameters.AddWithValue("@1", OleDbType.VarChar).Value = TxtPassWord.Text
                        cmd.Parameters.AddWithValue("@2", OleDbType.VarChar).Value = TxtUser.Text
                        cmd.Parameters.AddWithValue("@3", OleDbType.VarChar).Value = DateAndTime.Now()
                        'cmd.Parameters.AddWithValue("@confirmotpass", confirmotpass)
                        cmd.ExecuteNonQuery()
                    End Using
                    TxtUser.Text = ""
                    TxtPassWord.Text = ""
                    Me.Hide()
                    Form1.Show()
                Else
                    MsgBox("Problèm
    
    Richard DeemingR 1 Reply Last reply
    0
    • A ago2486

      j'ai une base de donnée Admin et une autre PersonneActive et je souhaiterais recuperer les info dela table Admin pour l'inserer dans la table PersonneActive mais mon soucis c'est qu'il s'enregistre duex et je ne c'est pourquoi.

      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Try
      If TxtUser.Text = Nothing Or TxtPassWord.Text = Nothing Then
      MsgBox("Veuillez renseigner tous les champs", MsgBoxStyle.Exclamation)
      Else
      If cnx.State = ConnectionState.Closed Then
      cnx.Open()
      End If

                  'VERIFER LES ENREGISTREMENTS DANS LA BASE DE DONNEE
                  'cnx.Open()
                  Dim searchQuery As String = "select count(\*) from Admin WHERE RefAdmin=? and MotDePasse=?"
                  Dim Command As New OleDbCommand(searchQuery, cnx)
      
                  Command.Parameters.AddWithValue("@1", OleDbType.VarChar).Value = TxtUser.Text
                  Command.Parameters.AddWithValue("@2", OleDbType.VarChar).Value = TxtPassWord.Text
      
                  Dim count = Convert.ToInt32(Command.ExecuteScalar())
      
                  If (count > 0) Then
                      MsgBox("Mot de passe validé avec succès'" & TxtUser.Text & "'", MsgBoxStyle.Information)
                      'DECLARATION DES VARIABLES 
                      Dim motpass, nom, dateactive As String
                      motpass = TxtPassWord.Text
                      nom = TxtUser.Text
                      dateactive = DateAndTime.Now()
                      Dim insert2 As String = "INSERT INTO \[PersonneActive\] (\[MotPasseActive\], \[NomActive\], \[DateActive\]) VALUES (@motpass, @nom, @dateactive)"
                      Using cmd As New OleDbCommand(insert2, cnx)
                          'cmd.Parameters.AddWithValue("", 1)
                          cmd.Parameters.AddWithValue("@1", OleDbType.VarChar).Value = TxtPassWord.Text
                          cmd.Parameters.AddWithValue("@2", OleDbType.VarChar).Value = TxtUser.Text
                          cmd.Parameters.AddWithValue("@3", OleDbType.VarChar).Value = DateAndTime.Now()
                          'cmd.Parameters.AddWithValue("@confirmotpass", confirmotpass)
                          cmd.ExecuteNonQuery()
                      End Using
                      TxtUser.Text = ""
                      TxtPassWord.Text = ""
                      Me.Hide()
                      Form1.Show()
                  Else
                      MsgBox("Problèm
      
      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      You are storing passwords in plain text. Don't do that! Secure Password Authentication Explained Simply[^] Salted Password Hashing - Doing it Right[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups