私はこの問題で立ち往生していて、それを修正できないようです。以下のコードが実行され、1 つのレコードが更新された場合は checkinsert が 1 を返し、何も更新されていない場合は 0 を返します。問題は Access にあり、テーブルの列は更新されません。
うまくいかない理由がわからないので、新鮮な目で問題を特定できることを願っています。
View in Access の更新プログラムを実行すると、問題なく動作します。
UPDATE tblStudentNameAndScore
SET tblStudentNameAndScore.QuizCount = QuizCount+1,
tblStudentNameAndScore.TimeLastQuestionAsked = Now()
WHERE tblStudentNameAndScore.StudentID=[?];
VB.Net
Public Function UpdateStudentScoreIfAnswerCorrect(ByVal studentId As String) As String
Try
Dim strAccessConn As String = _appConfigDbConn
Dim cn As OleDbConnection = New OleDbConnection(strAccessConn)
cn.Open()
Dim da As New OleDbCommand("qryUpdateStudentScore", cn)
da.CommandType = CommandType.StoredProcedure
'da.Parameters.AddWithValue("@StudentID", studentId)
da.Parameters.Add("@StudentID", OleDbType.VarChar).Value = studentId
Dim checkinsert As New Integer
checkinsert = da.ExecuteNonQuery()
If checkinsert > 0 Then
Return "Success"
End If
cn.Close()
cn.Dispose()
Return "Fail"
Catch ex As Exception
Throw New ApplicationException(ex.InnerException.Message.ToString())
End Try
End Function
Access 2010 と VB.NET Express を使用しています
助けてくれてありがとう