
dikmus
Posts: 19
|
| Posted: 12/28/2005, 11:46 AM |
|
Hi,
After adding a new employee, i want to jump to a "tasks" page where i can add tasks for that new employee.
This would be easy if i could add the new employeeId (autonumber field) as a parameter when jumping to that task page.
How can this be done?
THnaks Dik
_________________
www.musit.nl |
 |
 |
RainerSchober
Posts: 4
|
| Posted: 01/03/2006, 3:26 AM |
|
Under ASP (not ASP.NET!) i did the followng:
Common.asp - Class clsDBConn (like Function Execute)
the difference is the CursorType (adOpenKeyset)
Function ExecuteKeySet(varCMD)
Dim ErrorMessage, objResult
Errors.Clear
Set objResult = Server.CreateObject("ADODB.Recordset")
objResult.CursorType = adOpenKeySet
objResult.LockType = adLockOptimistic
If TypeName(varCMD) = "Command" Then
Set varCMD.ActiveConnection = objConnection
Set objResult.Source = varCMD
LastSQL = varCMD.CommandText
Else
Set objResult.ActiveConnection = objConnection
objResult.Source = varCMD
LastSQL = varCMD
End If
On Error Resume Next
objResult.Open
Errors.AddError CCProcessError(objConnection)
On Error Goto 0
Set ExecuteKeySet = objResult
End Function
on the page where i had to use the new Autincremental Key it was like:
Set objRecordSet = objConnection.ExecuteKeySet ("SELECT TOP 1 * FROM Table1")
objRecordSet.AddNew
objRecordSet("Field1") = ...
objRecordSet("Field2") = ...
objRecordSet("Field3") = ...
objRecordSet("Field4") = ...
objRecordSet.Update
NewRecordID = objRecordSet ("ID")
maybe it works the same way with the Update-Statement generated by CodeCharge and use ExecuteKeyset instead of Execute
best regards, Rainer
|
 |
 |
|

|
|
|
|