***CODE START
'Connection Objects
Dim sqlConn As ADODB.Connection
Dim sqlCmd As ADODB.Command
Dim sqlRS As ADODB.Recordset
' Establish connection.
Set sqlConn = New ADODB.Connection
sqlConn.ConnectionString = CurrentProject.Connection
sqlConn.Open
sqlConn.CursorLocation = adUseClient 'Cache data locally
Set sqlCmd = New ADODB.Command
' Open recordset.
With sqlCmd
.ActiveConnection = sqlConn
.CommandText = "sp_UI_AddServiceRelationship"
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters("@ParentRId").Value =
ReturnRelationshipID(destinationnode.Key)
.Parameters("@ServiceName").Value = draggednode.Text
.Parameters("@Sequence").Value = intNewSeqID
End With
Set sqlRS = sqlCmd.Execute
'!!!! At this point sqlRS recordset should not be EMPTY FFS!!!
'Close the connection to the server
sqlConn.Close
Set sqlConn = Nothing
'Close remaining connections
sqlRS.Close
Set sqlRS = Nothing
Set sqlCmd = Nothing
***CODE END
My current solution to this problem was to write a second SP which
returns the value that 'sp_UI_AddServiceRelationship' should be
returning in the first place as follows:
***CODE START
'Connection Objects
Dim sqlConn As ADODB.Connection
Dim sqlCmd As ADODB.Command
Dim sqlRS As ADODB.Recordset
' Establish connection.
Set sqlConn = New ADODB.Connection
sqlConn.ConnectionString = CurrentProject.Connection
sqlConn.Open
sqlConn.CursorLocation = adUseClient 'Cache data locally
Set sqlCmd = New ADODB.Command
' Open recordset.
With sqlCmd
.ActiveConnection = sqlConn
.CommandText = "sp_UI_AddServiceRelationship"
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters("@ParentRId").Value =
ReturnRelationshipID(destinationnode.Key)
.Parameters("@ServiceName").Value = draggednode.Text
.Parameters("@Sequence").Value = intNewSeqID
End With
Set sqlRS = sqlCmd.Execute
'!!!! At this point sqlRS recordset should not be EMPTY FFS!!!
With sqlCmd
.ActiveConnection = sqlConn
.CommandText = "sp_UI_GetLastAddedRID"
.CommandType = adCmdStoredProc
End With
Set sqlRS = sqlCmd.Execute
'!!!! sqlRS recordset now contains the required data!!!
'Close the connection to the server
sqlConn.Close
Set sqlConn = Nothing
'Close remaining connections
sqlRS.Close
Set sqlRS = Nothing
Set sqlCmd = Nothing
***CODE END
Could anyone be so kind and point out the problem??
Kind regards,
Fletch