Public Function InsertTempCaseRecord(ByVal tiBlockID As Integer, ByVal tiPerID As Integer, ByVal tiProcID As Integer) As Integer Dim lcConnectionString As String lcConnectionString = "provider=sqloledb.1;server=cqi-termserv;uid=ctore;pwd=cqi00;database=ctore" Dim lcSQL As String Dim oConn As OleDb.OleDbConnection Dim oCommand As New OleDb.OleDbCommand() oCommand.CommandText = "ctInsertTempCase" oCommand.CommandType = CommandType.StoredProcedure ' Build the Parameter list ----------------------------------------------------- ' BlockID Dim oParam1 As New OleDb.OleDbParameter("@t_Command", OleDb.OleDbType.Integer) oParam1.Value = tiBlockID oCommand.Parameters.Add(oParam1) ' coPerID Dim oParam2 As New OleDb.OleDbParameter("@t_Command", OleDb.OleDbType.Integer) oParam2.Value = tiPerID oCommand.Parameters.Add(oParam2) ' ProcID Dim oParam3 As New OleDb.OleDbParameter("@t_Command", OleDb.OleDbType.Integer) oParam3.Value = tiProcID oCommand.Parameters.Add(oParam3) 'Create Connection----------------------------------------------------------------------- oConn = VFPToolkit.vfpData.SqlConnect(lcConnectionString) oCommand.Connection = oConn 'Run Command----------------------------------------------------------------------------- Try VFPToolkit.vfpData.SqlExecute(oConn, oCommand, "actview") Catch 'Exception End Try 'Get the Identity Number Assigned ------------------------------------------------------------ Dim idView As DataView lcSQL = "select @@IDENTITY as LastID" Dim iRecords As Integer iRecords = 0 idView = VFPToolkit.vfpData.SqlExecute(oConn, lcSQL, "tcAlias") VFPToolkit.vfpData.Select(idView) iRecords = VFPToolkit.vfpData.Count(idView) Dim drv As DataRowView Dim iLastID As Integer If iRecords > 0 Then For Each drv In idView iLastID = drv("LastID") Next Else iLastID = 0 End If 'Break Connection------------------------------------------------------------------------- VFPToolkit.vfpData.SqlDisConnect(oConn) 'Set Our return Value------------------------------------------------------------------------- Return (iLastID) End Function