MichaelaLee
Programmer
Hi All,
I'm having a slight problem trying to get a resultset back from an Access 2000 database. I have the following code:
SQL Query:
PARAMETERS [lStudentId] Long;
SELECT StudentCourses.CourseID, Courses.CourseTitle, StudentCourses.StudentID, StudentCourses.StartDate, StudentCourses.CompletionDate, Courses.CourseDescription, Courses.CourseCredits, Courses.Section
FROM StudentCourses INNER JOIN Courses ON StudentCourses.CourseID = Courses.CourseID
WHERE StudentCourses.StudentID=[lStudentId];
VB Code:
If rsAssigned.State <> adStateClosed Then
rsAssigned.Close
End If
Set mCommand = New ADODB.Command
mCommand.CommandType = adCmdUnknown
mCommand.CommandText = "GetAssignedByStudentId"
Set mParam = mCommand.CreateParameter("lStudentId", adInteger, adParamInput)
mParam.Value = StudentId
mCommand.Parameters.Append mParam
mCommand.ActiveConnection = ado
rsAssigned.CursorType = adOpenKeyset
rsAssigned.LockType = adLockOptimistic
Set rsAssigned = mCommand.Execute
A Note about the Execute command. When the last line is run, the CursorType and LockType change to:
CursorType = 0 (adOpenForwardOnly)
LockType = 1 (adLockPessimistic)
What do you all think. Thanks for any help.
Michael
I'm having a slight problem trying to get a resultset back from an Access 2000 database. I have the following code:
SQL Query:
PARAMETERS [lStudentId] Long;
SELECT StudentCourses.CourseID, Courses.CourseTitle, StudentCourses.StudentID, StudentCourses.StartDate, StudentCourses.CompletionDate, Courses.CourseDescription, Courses.CourseCredits, Courses.Section
FROM StudentCourses INNER JOIN Courses ON StudentCourses.CourseID = Courses.CourseID
WHERE StudentCourses.StudentID=[lStudentId];
VB Code:
If rsAssigned.State <> adStateClosed Then
rsAssigned.Close
End If
Set mCommand = New ADODB.Command
mCommand.CommandType = adCmdUnknown
mCommand.CommandText = "GetAssignedByStudentId"
Set mParam = mCommand.CreateParameter("lStudentId", adInteger, adParamInput)
mParam.Value = StudentId
mCommand.Parameters.Append mParam
mCommand.ActiveConnection = ado
rsAssigned.CursorType = adOpenKeyset
rsAssigned.LockType = adLockOptimistic
Set rsAssigned = mCommand.Execute
A Note about the Execute command. When the last line is run, the CursorType and LockType change to:
CursorType = 0 (adOpenForwardOnly)
LockType = 1 (adLockPessimistic)
What do you all think. Thanks for any help.
Michael