Click here to Skip to main content
14,486,704 members

Visual Basic

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 22:40
cofounderChris Maunder12-Jul-09 22:40 
PinnedHow to get an answer to your question PinPopular
Chris Maunder10-Nov-05 16:30
cofounderChris Maunder10-Nov-05 16:30 
QuestionHow to update sql server data from excel data using VBA code by all User Pin
Member 1478441627-Mar-20 0:25
MemberMember 1478441627-Mar-20 0:25 
AnswerRe: How to update sql server data from excel data using VBA code by all User Pin
ZurdoDev27-Mar-20 1:19
mveZurdoDev27-Mar-20 1:19 
GeneralRe: How to update sql server data from excel data using VBA code by all User Pin
Member 1478441627-Mar-20 2:17
MemberMember 1478441627-Mar-20 2:17 
Questionevent handler Pin
Member 1356965021-Mar-20 23:16
MemberMember 1356965021-Mar-20 23:16 
AnswerRe: event handler Pin
Richard MacCutchan21-Mar-20 23:31
mveRichard MacCutchan21-Mar-20 23:31 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 0:24
MemberMember 1356965022-Mar-20 0:24 
GeneralRe: event handler Pin
Richard MacCutchan22-Mar-20 0:33
mveRichard MacCutchan22-Mar-20 0:33 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 1:04
MemberMember 1356965022-Mar-20 1:04 
GeneralRe: event handler Pin
Richard MacCutchan22-Mar-20 4:03
mveRichard MacCutchan22-Mar-20 4:03 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 4:18
MemberMember 1356965022-Mar-20 4:18 
GeneralRe: event handler Pin
Richard MacCutchan22-Mar-20 4:47
mveRichard MacCutchan22-Mar-20 4:47 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 5:01
MemberMember 1356965022-Mar-20 5:01 
GeneralRe: event handler Pin
Richard MacCutchan22-Mar-20 5:12
mveRichard MacCutchan22-Mar-20 5:12 
GeneralRe: event handler Pin
Richard MacCutchan22-Mar-20 5:11
mveRichard MacCutchan22-Mar-20 5:11 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 5:48
MemberMember 1356965022-Mar-20 5:48 
GeneralRe: event handler Pin
Richard MacCutchan22-Mar-20 5:52
mveRichard MacCutchan22-Mar-20 5:52 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 5:52
MemberMember 1356965022-Mar-20 5:52 
GeneralRe: event handler Pin
Richard MacCutchan22-Mar-20 5:53
mveRichard MacCutchan22-Mar-20 5:53 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 6:13
MemberMember 1356965022-Mar-20 6:13 
GeneralRe: event handler Pin
Victor Nijegorodov22-Mar-20 0:48
MemberVictor Nijegorodov22-Mar-20 0:48 
QuestionIssue Adding a WebService (WSDL) Pin
Member 1185690418-Mar-20 13:06
MemberMember 1185690418-Mar-20 13:06 
Questionvb.net Pin
ago248616-Mar-20 1:23
Memberago248616-Mar-20 1:23 
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ème avec le mot de passe ou Compte intouvable... Veuillez contacter l'administrateur AGO KOUAME BERTRAND", MsgBoxStyle.Critical)
                  TxtUser.Text = ""
                  TxtPassWord.Text = ""
              End If
          End If
          'Dim adapter As New OleDbDataAdapter(Command)
          'Dim ds As New DataSet
          'Dim table As New DataTable
          'adapter.Fill(ds, "CERTIFICAT")
          'DataGridView1.DataSource = ds.Tables("CERTIFICAT")

          'adapter.Dispose()
      Catch ex As Exception
          MsgBox(ex.Message)
      Finally
          cnx.Close()
      End Try
  End Sub

SuggestionRe: vb.net Pin
Richard Deeming16-Mar-20 9:41
mveRichard Deeming16-Mar-20 9:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.