Bonjour à tous,

Je réalise une application en Visual Studio 2010 et une base MS Access 2010.

Je souhaiterais récupérer les Usagers précédemment enregistrer par les rééducateurs avec qui ils ont eu une rééducation :

La ComboBox nous permet de sélectionner un rééducateur

La ListBox nous affiche les Usagers précédemment enregistré par le rééducateur "Sélectionné" dans la ComboBox

Voici le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Private Sub lstEnfants()
 
        'Récupérer le numéro du rééducateur afin d'afficher les Usagers correspondants
        Dim vNomReeducateur As String = CStr(lstSelectEnfant.SelectedItem)
        <strong><span style="color:#ff0000;"><em>fourthSQL = "SELECT noReeduc FROM reeducateur WHERE nomReeduc LIKE " & vNomReeducateur & "%"</em></span></strong>
        dta.SelectCommand.CommandText = fourthSQL
        dta.Fill(dts, "reeducateur")
 
        For i = 0 To dts.Tables("reeducateur").Rows.Count - 1
            Dim en As IEnumerator
            en = dts.Tables("reeducateur").Rows.GetEnumerator
            en.Reset()
 
            Do While en.MoveNext()
                vNomReeducateur = en.Current("nomReeduc")
                If vNomReeducateur = en.Current("nomReeduc") Then
 
                    If vNomReeducateur = dts.Tables("reeducateur").Rows(i).Item("nomReeduc") Then
                        Dim varNoReeducateur As Integer = dts.Tables("reeducateur").Rows(i).Item("noReeduc")
 
                        'Remplir la liste des usagers
                        firstSQL = "SELECT * FROM acte WHERE noUsager = ?"
                        dta.SelectCommand.CommandText = firstSQL
                        dta.SelectCommand.Parameters.Add("@p1", OleDbType.Integer).Value = varNoReeducateur
                        dta.Fill(dts, "acte")
 
                        For j = 0 To dts.Tables("acte").Rows.Count - 1
                            'Récupérer tous les champs de la table acte dans des variables
                            Dim varNoUsager As Integer = CInt(dts.Tables("acte").Rows(i).Item("noUsager"))
                            Dim varNomUsager As String = CStr(dts.Tables("acte").Rows(i).Item("nomUsager"))
                            Dim varPrenomUsager As String = CStr(dts.Tables("acte").Rows(i).Item("prenomUsager"))
                            Dim varNoSem As Integer = CInt(dts.Tables("acte").Rows(i).Item("noSem"))
                            Dim varMois As String = CStr(dts.Tables("acte").Rows(i).Item("mois"))
                            Dim varNbActes As Integer = CInt(dts.Tables("acte").Rows(i).Item("nbActe"))
 
                            lstSelectEnfant.Items.Add(varNomUsager & " " & _
                                                                    varPrenomUsager & " " & _
                                                                    varNoSem & " " & _
                                                                    varMois & " " & _
                                                                    varNbActes)
 
                        Next
                    End If
                End If
            Loop
        Next
    End Sub
Le message d'erreur que vb.net me retourne est le suivant :
Comme vous le voyez ce code se trouve dans une procédure "Private Sub LstEnfants()",

J'appelle cette procédure dans mon ComboBox "cbBoxSelectionnerReeducateur_SelectedIndexChanged".

Le message d'erreur que VB.NET me retourne est le suivant :

"Le paramètre ?_1 n'a pas de valeur par défaut."

Voici le détail :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
L'exception System.Data.OleDb.OleDbException n'a pas été gérée
  ErrorCode=-2147217904
  HResult=-2147217904
  Message=Le paramètre ?_1 n'a pas de valeur par défaut.
  Source=Microsoft Access Database Engine
  StackTrace:
       à System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
       à System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
       à System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
       à System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
       à System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
       à System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
       à System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
       à System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       à System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       à System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
       à AppBReeducateur.frmEnregistrementSemaine.lstEnfants() dans D:\Projet\Java\Reeducateur\AppBReeducateur\AppBReeducateur\frmEnrSemaine.vb:ligne 53
       à AppBReeducateur.frmEnregistrementSemaine.cbBoxSelectionnerReeducateur_SelectedIndexChanged(Object sender, EventArgs e) dans D:\Projet\Java\Reeducateur\AppBReeducateur\AppBReeducateur\frmEnrSemaine.vb:ligne 97
       à System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
       à System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)
       à System.Windows.Forms.ComboBox.NotifyAutoComplete(Boolean setSelectedIndex)
       à System.Windows.Forms.ComboBox.OnKeyDown(KeyEventArgs e)
       à System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
       à System.Windows.Forms.ComboBox.ProcessKeyEventArgs(Message& m)
       à System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
       à System.Windows.Forms.ComboBox.ChildWndProc(Message& m)
       à System.Windows.Forms.ComboBox.ComboBoxChildNativeWindow.WndProc(Message& m)
       à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       à System.Windows.Forms.Application.Run(ApplicationContext context)
       à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       à AppBReeducateur.My.MyApplication.Main(String[] Args) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 81
       à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       à System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Si ça peux vous aidez, quand je fais du pas à pas détailler il me dit Nothing à la déclaration suivante :

"Dim vNomReeducateur As String = CStr(lstSelectEnfant.SelectedItem)"

Quelqu'un pourait-il m'aider s'il vous plais ?