salut,
tu peut essayer avec:
Public Class Recherche
Dim con As ADODB.Connection
Dim resk, resl As ADODB.Recordset
'----------------------------------------------------------------------
Private Sub FormRecherche_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con = New ADODB.Connection
con.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\??????.mdb;")
End Sub
'----------------------------------------------------------------------
Private Sub btrecherche_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btrecherche.Click
resk = New ADODB.Recordset
resk.Open("select * from Stagiaire where Matricule='" + txt1.Text + "' , con, ADODB.CursorTypeEnum.adOpenKeyset, DODB.LockTypeEnum.adLockOptimistic)
Try
'je suppose que le Text1=matricule Stagiaire
Form1.txt1.Text = resk.Fields(0).Value
'pour le combobox si possible
Form1.combo1.SelectedText = resk.Fields(1).Value
If resk.EOF = True Then
MsgBox("Ce numéro matricule n'existe pas")
End If
Catch
End Try
'désactive ce que tu peut
'par exemle Form1.txt1.visible=false
If Form1.txt1.Text = "" Then
MsgBox("Ce statgiaire n'exixte pas !!!")
'Tu fait appel au menu soliciter
Menu_principal.Show()
Me.Close()
Else
'Tu fait appel au menu2 soliciter
Form1.Show()
End If
End Sub
End Class
'--------------------------------------------------------------------------------------------------------------------------
Private Sub ButtonModifier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonModifier.Click
resq = New ADODB.Recordset
resq.Open("select * from Stagiaire where Matricule='" + Recherche.txt1.Text + "' , con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
res = New ADODB.Recordset
'si ton combo recupere les données dans une autre table
res.Open("select * from XXXXXX where niveau='" + combo1.SelectedItem + "'", con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
resq.Fields(0).Value = txt1.Text
resq.Fields(1).Value = combo1.SelectedItem
resq.Update()
End Sub
'-----------------------------------------------------------------------------
Private Sub btsupprimer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btsupprimer.Click
res = New ADODB.Recordset
'je suppose que dans ton combo tu recupere le niveau dans la Table Niveau
res.Open("SELECT Stagiaire.Matricule,Niveau.CodeNiveau From Stagiaire INNER JOIN Niveau ON Stagiaire.Codniveau = Niveau.Codeniveau", con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
Try
res.Delete()
Catch
End Try
End Sub
rex mindongo kaniki the king @