vb.net
-
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
-
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
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