Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.
Public Function ExecuteID(ByVal SQl As String) As Long 'PURPOSE: RETURN VALUE OF IDENTITY COLUMN OF A NEWLY INSERTED RECORD 'SQL is a valid Insert statement. 'ConnetionString property has been set to a valid Connection String On Error GoTo LocalError Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim AutoID As Long With rs 'Prepare the RecordSet .CursorLocation = ADODB.CursorLocationEnum.adUseServer .CursorType =ADODB.CursorTypeEnum.adOpenForwardOnly .LockType = ADODB.LockTypeEnum.adLockReadOnly .Source = "SELECT @@IDENTITY" End With With cn .ConnectionString = ConnectionString .CursorLocation = ADODB.CursorLocationEnum.adUseServer .Open() .BeginTrans() .Execute(SQl, , ADODB.CommandTypeEnum.adCmdText + ADODB.CommandTypeEnum.adExecuteNoRecords) With rs .ActiveConnection = cn .Open(, , , , ADODB.CommandTypeEnum.adCmdText) AutoID = rs(0).Value .Close() End With .CommitTrans() .Close() End With rs = Nothing cn = Nothing 'If we get here ALL was Okay ExecuteID = AutoID Exit Function LocalError: m_sLastError = Err.Number & " - " & Err.Description ExecuteID = 0 End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.