My first message was too laconic, and I apologize. I will try to be more
precise and especially to use the correct vocabulary.
The purpose of the program is to keep track of the results of my students
when they use my mental calculation software (called Mathadore:
http://www.scalpa.info/new_logiciels.php). So I created a database,
"calcul_mental.mdb" with Access which here is a screenshot
(
http://www.scalpa.info/mabase.jpg). I created a dataset from the database
in "VB2008 express" called calcul_mentalDataSet. (I followed the explanation
described in section C. (Here is the translation of this page :
http://translate.google.fr/translate?u=http% 3A% 2F%
2Fplasserre.developpez.com% 2Fv6-6.htm & sl tl = en & hl = en & = en & ie =
UTF-8).
1° When the program starts, the child must either identify (
frmListEleves.vb) or register (frmNewEleve.vb) if this is his first visit.
2° The student, once identified or registered, can choose an activity.
3° I want to keep track of these activities in the table "Resultats". So I
store in this table all the informations regarding the student
authenticated.
4° This is where my trouble begins ... For each activity in "Mathadore"
(Frm_decomposer.vb, Frm_encadrer.vb, etc.). I must record the results
obtained by the student in the table "Resultats".
a) I find it hard to retrieve, by programming, "DataRow" which
corresponds to the student currently authenticated. I tried with a dt.find,
but without success (probably because of the structure of my database that
is not well thought at the primary keys?)
So I tried to find the DataRow in the table "Results" which corresponds to
the current student like this:
Dim drCurrent As DataRow()
Dim strExpr As String
strExpr = "N_Eleve = '" & NumEleve & "'"
drCurrent = dt.Select(strExpr)
without being sure it works, because then I could not change the content of
the Table "Results". An error occur here in the code:
'Add infos : notes, temps etc;
drCurrent("Date") = DatePassage ' Error 1 A value of type 'Date'
can not be converted into 'System.Data.DataRow'
I hope this help to understand my goal and my problem.
Thanks to all the people spending their time on this.... "newbee-mess"
Merry Xmas
Pascal
Below the code of the module:
###########################
Imports System.Data
Module ModStats
Public NumEleve As Integer 'n° de l'élève
Public MonNOM As String 'Nom de l'élève
Public MonPrenom As String 'Prénom de l'élève
Public MaDdn As Date 'Date de naissance de l'élève
Public MonExo As String 'Titre de l'exercice comme dans la barre de
titre
Public MonTemps As Date 'Durée passée à faire l'exercice
Public Debut As Date
Public Fin As Date
Public MaNote As Single 'Note sur 20 obtenue
Public MaFrequence As Short 'Nombre de fois où l'exercice fut tenté.
Public DatePassage As Date = Now 'Date à laquelle l'exercice fut fait
Public Consigne As String = "" 'Consigne de l'exercice
'
http://plasserre.developpez.com/v6-5.htm
'Déclaration de la connexion
Public Connection As New OleDb.OleDbConnection
'Déclaration du DataSet
Public MonDataSet As New DataSet
'Déclaration du dataAdapter ("Resultats" est la table access que j'ai
crée dans le fichier mabase.mdb)
Public MonAdapter As New OleDb.OleDbDataAdapter("select * from
Resultats", Connection)
Public Sub EnregistrerResultats()
' On vide le dataset (Is it necessary?)
MonDataSet.Clear()
'on paramètre la chaîne de connexion pour la base de donnée
Connection.ConnectionString = "provider=microsoft.jet.oledb.4.0;" &
"data source= " & _
Application.StartupPath & "\" & "calcul_mental.mdb;"
'On rempli le DataSet:
MonAdapter.Fill(MonDataSet, "Resultats")
'Connection.Close()
Dim dt As New DataTable()
dt = MonDataSet.Tables("Resultats")
'dt.DefaultView.RowFilter = String.Format("Nom='{0}' AND
Prenom='{1}' AND Ddn='{2}'", MonNOM, MonPrenom, MaDdn)
Dim drCurrent As DataRow()
Dim strExpr As String
strExpr = "N_Eleve = '" & NumEleve & "'"
drCurrent = dt.Select(strExpr)
'ajouter les infos : notes, temps etc;
'drCurrent("Date") = DatePassage
'Connection.Close()
End Sub
Public Function FirstLetterToUpper(ByRef str As String)
str = UCase(Microsoft.VisualBasic.Left(str, 1)) & Mid(str, 2)
Return str
End Function
End Module