public async static Task <RetCode> CadastraCliente(string nomeCliente) { string connecionString = Environment.GetEnvironmentVariable("DbConnectionString"); RetCode retorno = RetCode.Erro; using (SqlConnection connection = new SqlConnection(connecionString)) { using (SqlCommand command = new SqlCommand()) { connection.Open(); command.Connection = connection; command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandText = "[sp_cadastraCliente]"; command.CommandTimeout = 0; command.Parameters.Add("@NomeCliente", System.Data.SqlDbType.VarChar).Value = nomeCliente; SqlDataReader reader = await command.ExecuteReaderAsync(); while (reader.Read()) { retorno = (RetCode)reader["ret_code"]; } } } return(retorno); }
public static StochFResult StochF( int startIdx, int endIdx, double[] high, double[] low, double[] close, int fastK_Period, int fastD_Period, MAType fastD_MAType) { int outBegIdx = default; int outNBElement = default; double[] outFastK = new double[endIdx - startIdx + 1]; double[] outFastD = new double[endIdx - startIdx + 1]; RetCode retCode = TACore.StochF( startIdx, endIdx, high, low, close, fastK_Period, fastD_Period, fastD_MAType, ref outBegIdx, ref outNBElement, ref outFastK, ref outFastD); return(new(retCode, outBegIdx, outNBElement, outFastK, outFastD)); }
public RetCode getName(out string name) { StringBuilder str = new StringBuilder(MAX_DEVICE_STR_LEN); RetCode ret = libgforce.device_get_name(hD, str, (uint)str.Capacity); if (RetCode.GF_SUCCESS == ret) { name = str.ToString(); if (!name.EndsWith(")")) { char[] address = getAddress().ToCharArray(); name += "("; name += address[3]; name += address[4]; name += address[0]; name += address[1]; name += ")"; } } else { name = "E" + ret; } return(ret); }
public async static Task <RetCode> CadastraColaborador(ColaboradorModel colaborador) { string connecionString = Environment.GetEnvironmentVariable("DbConnectionString"); RetCode retorno = RetCode.Erro; using (SqlConnection connection = new SqlConnection(connecionString)) { using (SqlCommand command = new SqlCommand()) { connection.Open(); command.Connection = connection; command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandText = "[sp_cadastraColaborador]"; command.CommandTimeout = 0; command.Parameters.Add("@NomeColaborador", System.Data.SqlDbType.VarChar).Value = colaborador.NomeColaborador; command.Parameters.Add("@DataNascimento", System.Data.SqlDbType.DateTime).Value = colaborador.DataNascimento; command.Parameters.Add("@IdDepartamento", System.Data.SqlDbType.Int).Value = colaborador.Departamento.IdDepartamento; command.Parameters.Add("@IdGenero", System.Data.SqlDbType.Int).Value = (int)colaborador.Genero; SqlDataReader reader = await command.ExecuteReaderAsync(); while (reader.Read()) { retorno = (RetCode)reader["ret_code"]; } } } return(retorno); }
public void setSelectionPaths(UInt64[] selectedPathsIndices) { if (0 == selectedPathsIndices.Length) { return; } int size = Marshal.SizeOf(selectedPathsIndices[0]) * selectedPathsIndices.Length; IntPtr pnt = Marshal.AllocHGlobal(size); try { Int64[] temp = new Int64[selectedPathsIndices.Length]; System.Buffer.BlockCopy(selectedPathsIndices, 0, temp, 0, temp.Length * 8); // Copy the array to unmanaged memory. Marshal.Copy(temp, 0, pnt, temp.Length); RetCode ret = setSelectionPaths(pnt, Convert.ToUInt64(temp.Length)); if (RetCode.NoError != ret) { throw new System.Exception("Error: set selection"); } } finally { Marshal.FreeHGlobal(pnt); } }
public JsonResult EntranceListDateAll() { JsonResult m_json = new JsonResult(); try { int iClassID = Pv.Pint(Request["ClassID"]); DateTime dtmDate = Pv.PDate(Request["Tarih"]); RetCode oRet = Util.DB.RunTable("EntranceListDateAll", iClassID, dtmDate); DataTable dtRooms = oRet.ToTable; m_json.Data = new { recordCount = dtRooms.Rows.Count, success = true, failure = false, error = "", data = Util.GetJsonData(dtRooms) }; m_json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; } catch (Exception eX) { Util.WriteLog(eX); } return(m_json); }
public JsonResult StudentListAll() { JsonResult m_json = new JsonResult(); try { //yt.lstRooms //yetkisi olan odalar gelsin RetCode oRet = Util.DB.RunTable("StudentList"); DataTable dtRooms = oRet.ToTable; m_json.Data = new { recordCount = dtRooms.Rows.Count, success = true, failure = false, error = "", data = Util.GetJsonData(dtRooms) }; m_json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; } catch (Exception eX) { Util.WriteLog(eX); } return(m_json); }
public string ReadBarkod() { string strReturn = ""; try { int iClassID = Pv.Pint(Request["ClassID"]); string strCardNumber = Pv.Pstr(Request["CardNumber"]); if (iClassID == 0) { return("-4"); } RetCode oRet = Util.DB.RunTable("ReadBarcode", iClassID, strCardNumber); if (oRet.iRet == Back.Ok) { strReturn = oRet.ToRow["Done"].ToString(); } } catch (Exception eX) { Util.WriteLog(eX); } return(strReturn); }
public string DeleteStudent() { //bir odaya bağlımı kontrol et öyle sil string strReturn = ""; try { //schedule varsa silme int iStudentID = Pv.Pint(Request["StudentID"]); RetCode oRet = Util.DB.RunTable("StudentDelete", iStudentID); if (oRet.iRet == Back.Ok) { strReturn = "1"; } } catch (Exception eX) { Util.WriteLog(eX); } return(strReturn); }
public static void compute(double[] data, int[] parameters, out double[] dataMACD, out double[] dataMACDSignal, out double[] dataMACDHist) { RetCode retCode = new RetCode(); retCode = RetCode.InternalError; dataMACD = new double[data.Length]; dataMACDSignal = new double[data.Length]; dataMACDHist = new double[data.Length]; int fastPeriod = parameters[0]; int slowPeriod = parameters[1]; int signalPeriod = parameters[2]; float[] dataSeries = Array.ConvertAll(data, d => (float)d); int outBegIdx = -1; int outNbElement = -1; int lookback = -1; double[] outMACD = new double[data.Length]; double[] outMACDSignal = new double[data.Length]; double[] outMACDHist = new double[data.Length]; lookback = MacdLookback(fastPeriod, slowPeriod, signalPeriod); retCode = Macd(0, data.Length - 1, dataSeries, fastPeriod, slowPeriod, signalPeriod, out outBegIdx, out outNbElement, outMACD, outMACDSignal, outMACDHist); Array.Copy(outMACD, 0, dataMACD, lookback, data.Length - lookback); Array.Copy(outMACDSignal, 0, dataMACDSignal, lookback, data.Length - lookback); Array.Copy(outMACDHist, 0, dataMACDHist, lookback, data.Length - lookback); }
internal static void GetDiagErrors(OdbcErrorCollection errors, string source, OdbcHandle hrHandle, RetCode retcode) { if (retcode != RetCode.SUCCESS) { short record = 0; short cchActual = 0; StringBuilder message = new StringBuilder(0x400); bool flag = true; while (flag) { int num3; string str; record = (short) (record + 1); retcode = hrHandle.GetDiagnosticRecord(record, out str, message, out num3, out cchActual); if ((RetCode.SUCCESS_WITH_INFO == retcode) && ((message.Capacity - 1) < cchActual)) { message.Capacity = cchActual + 1; retcode = hrHandle.GetDiagnosticRecord(record, out str, message, out num3, out cchActual); } if ((retcode == RetCode.SUCCESS) || (retcode == RetCode.SUCCESS_WITH_INFO)) { errors.Add(new OdbcError(source, message.ToString(), str, num3)); } } } }
public static void Write(this BinaryWriter writer, RetCode r) { #if DEBUG Console.WriteLine("return: {0}", r); #endif writer.Write((int)r); }
public static MacdResult Macd( int startIdx, int endIdx, double[] real, int optInFastPeriod, int optInSlowPeriod, int optInSignalPeriod) { int outBegIdx = 0; int outNBElement = 0; double[] outMACD = new double[endIdx - startIdx + 1]; double[] outMACDSignal = new double[endIdx - startIdx + 1]; double[] outMACDHist = new double[endIdx - startIdx + 1]; RetCode retCode = TACore.Macd( startIdx, endIdx, real, optInFastPeriod, optInSlowPeriod, optInSignalPeriod, ref outBegIdx, ref outNBElement, ref outMACD, ref outMACDSignal, ref outMACDHist); return(new(retCode, outBegIdx, outNBElement, outMACD, outMACDSignal, outMACDHist)); }
public IndicatorMACD(Donnees donnees) : base(donnees) { double[] outMACD = new double[ValeursClose.Count]; double[] outMACDSignal = new double[ValeursClose.Count]; double[] outMACDHist = new double[ValeursClose.Count]; int begin; int length; List <Double> valeursInversees = new List <double>(ValeursClose); valeursInversees.Reverse(); RetCode retCode = Core.Macd(0, valeursInversees.Count - 1, valeursInversees.ToArray(), 12, 26, 9, out begin, out length, outMACD, outMACDSignal, outMACDHist); MACD = new List <double>(outMACD); MACD = new List <double>(MACD.Where(X => Math.Abs(X) > Double.Epsilon)); MACD.Reverse(); MACDSignal = new List <double>(outMACDSignal); MACDSignal = new List <double>(MACDSignal.Where(X => Math.Abs(X) > Double.Epsilon)); MACDSignal.Reverse(); MACDHist = new List <double>(outMACDHist); MACDHist = new List <double>(MACDHist.Where(X => Math.Abs(X) > Double.Epsilon)); MACDHist.Reverse(); }
/// <summary> /// Calcul de la moyenne mobile à 7, 25 et 99. /// </summary> public IndicatorBOLL(Donnees donnees) : base(donnees) { double[] outputBOLLMID = new double[ValeursClose.Count]; double[] outputBOLLSUP = new double[ValeursClose.Count]; double[] outputBOLLINF = new double[ValeursClose.Count]; int begin; int length; List <Double> valeursInversees = new List <double>(ValeursClose); valeursInversees.Reverse(); RetCode retCode = Core.Bbands(0, valeursInversees.Count - 1, valeursInversees.ToArray(), 21, 2, 2, MAType.Ema, out begin, out length, outputBOLLSUP, outputBOLLMID, outputBOLLINF); BOLLMID = new List <double>(outputBOLLMID); BOLLMID = new List <double>(BOLLMID.Where(X => Math.Abs(X) > Double.Epsilon)); BOLLMID.Reverse(); BOLLSUP = new List <double>(outputBOLLSUP); BOLLSUP = new List <double>(BOLLSUP.Where(X => Math.Abs(X) > Double.Epsilon)); BOLLSUP.Reverse(); BOLLINF = new List <double>(outputBOLLINF); BOLLINF = new List <double>(BOLLINF.Where(X => Math.Abs(X) > Double.Epsilon)); BOLLINF.Reverse(); CalculDerivees(); }
public override BaseReqResult Execute(RetCode retCode, GenOneReqInParm <Guid> req) { BaseReqResult result = new BaseReqResult() { RetCode = retCode }; try { if (GetAction <IRTDelete <Document> >().Execute(retCode, GetAction <IRTQuery <Document> >().Execute(retCode, o => o.StreamId == req.Parm_01).ToList())) { SetRetCode(retCode, CommonCode.OK); } else { SetRetCode(retCode, CommonCode.DeleteDataFail, "stream_id=" + req.Parm_01.ToString()); } } catch (Exception ex) { Logger.Fatal(ex.Message); SetRetCode(retCode, CommonCode.Fail, ex.Message); } return(result); }
public async Task <IActionResult> CadastraCliente( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); RetCode retorno = RetCode.Erro; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); ClienteModel data = JsonConvert.DeserializeObject <ClienteModel>(requestBody); if (string.IsNullOrWhiteSpace(data.NomeCliente)) { return(new OkObjectResult("Nome não informado")); } try { retorno = await ClienteModel.CadastraCliente(data.NomeCliente); if (retorno == RetCode.Erro) { return(new OkObjectResult("Erro ao cadastrar cliente")); } } catch (Exception e) { log.LogError(e, "Erro ao cadastrar cliente"); return(new OkObjectResult("Erro ao cadastrar cliente")); } return(new OkObjectResult("Cliente cadastrado com sucesso")); }
/// <summary> /// Converts the error code to int. /// </summary> /// <param name="value">The value.</param> /// <returns>System.Int32.</returns> public static int ConvertErrorCodeToInt(RetCode value) { var retCode = -1; retCode = (int)Enum.Parse(typeof(RetCode), Enum.GetName(typeof(RetCode), value)); return(retCode); }
public override GenOneStringReqResult Execute(RetCode retCode, GenTwoReqInParm <string, IFileReqInParm> req) { var result = new GenOneStringReqResult() { RetCode = retCode }; try { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@subPath", req.Parm_01), new SqlParameter("@fileName", req.Parm_02.NameWithTimespan), new SqlParameter("@fileData", req.Parm_02.Content), new SqlParameter("@streamId", SqlDbType.UniqueIdentifier) }; parameters[3].Direction = ParameterDirection.Output; var dbResult = GetAction <IQueryByStoredProcedure <Document, string> >().Execute(retCode, new GenTwoReqInParm <string, IEnumerable <IDataParameter> > { Parm_01 = "USP_AddDocument", Parm_02 = parameters }); result.Text = parameters[3].Value.ToString(); if (string.IsNullOrEmpty(result.Text)) { SetRetCode(retCode, CommonCode.Fail, "發生預期外的錯誤。"); } } catch (Exception ex) { Logger.Fatal(ex.Message); SetRetCode(retCode, CommonCode.Fail, ex.Message); } return(result); }
/// <summary> /// Calcul de la moyenne mobile à 7, 25 et 99. /// </summary> public IndicatorSTOCHRSI(Donnees donnees) : base(donnees) { double[] stock_K = new double[ValeursClose.Count]; double[] stock_D = new double[ValeursClose.Count]; int begin; int length; double[] rsi = new double[ValeursClose.Count]; List <Double> valeursInversees = new List <double>(ValeursClose); valeursInversees.Reverse(); RetCode retCode = Core.Rsi(0, valeursInversees.Count - 1, valeursInversees.ToArray(), 14, out begin, out length, rsi); List <Double> RSI = new List <double>(rsi); RSI = new List <double>(RSI.Where(X => X != 0)); RSI.Reverse(); STOCK_K = new List <double>(); STOCK_D = new List <double>(); for (int i = 0; i < RSI.Count - 15; i++) { double min = RSI.GetRange(i, 9).Min(); double max = RSI.GetRange(i, 9).Max(); double k = 100 * (RSI[i] - min) / (max - min); STOCK_K.Add(k); } Core.Sma(0, STOCK_K.Count - 1, STOCK_K.ToArray(), 3, out begin, out length, stock_D); STOCK_D = new List <double>(stock_D); CalculDerivees(); }
public RetCode registerListener(HubListener ls) { RetCode ret = RetCode.GF_SUCCESS; if (mListeners.Add(ls)) { if (mListeners.Count() == 1) { mListenerDele = new libgforce.ListenerDelegate(); mListenerDele.onScanfinishedFn = new libgforce.onScanfinished(Hub.onScanfinishedImpl); mListenerDele.onStateChangedFn = new libgforce.onStateChanged(Hub.onStateChangedImpl); mListenerDele.onDeviceFoundFn = new libgforce.onDeviceFound(Hub.onDeviceFoundImpl); mListenerDele.onDeviceDiscardFn = new libgforce.onDeviceDiscard(Hub.onDeviceDiscardImpl); mListenerDele.onDeviceConnectedFn = new libgforce.onDeviceConnected(Hub.onDeviceConnectedImpl); mListenerDele.onDeviceDisconnectedFn = new libgforce.onDeviceDisconnected(Hub.onDeviceDisconnectedImpl); mListenerDele.onOrientationDataFn = new libgforce.onOrientationData(Hub.onOrientationDataImpl); mListenerDele.onGestureDataFn = new libgforce.onGestureData(Hub.onGestureDataImpl); mListenerDele.onDeviceStatusChangedFn = new libgforce.onDeviceStatusChanged(Hub.onDeviceStatusChangedImpl); mListenerDele.onExtendedDeviceDataFn = new libgforce.onExtendedDeviceData(Hub.onExtendedDeviceDataImpl); ret = libgforce.hub_register_listener(ref mListenerDele); } } else { // if already added, do nothing but return GF_SUCCESS } return(ret); }
private void RunThreadFn() { int loop = 0; while (threadRunning_) { RetCode ret = hub_.run(50); if (RetCode.GF_SUCCESS != ret && RetCode.GF_ERROR_TIMEOUT != ret) { System.Threading.Thread.Sleep(5); continue; } loop++; #if DEBUG if (loop % 200 == 0) { System.Console.WriteLine("runThreadFn: {0} seconds elapsed.", loop / 20); } #endif } System.Console.WriteLine("Leave thread"); }
private void prepare() { mFoundDevices.Clear(); mLsn = new Listener(this); #if !UNITY_ANDROID mHub.setClientLogMethod(logfun); #endif RetCode ret = mHub.registerListener(mLsn); Debug.LogFormat("registerListener = {0}", ret); ret = mHub.init(0); Debug.LogFormat("init = {0}", ret); Debug.LogFormat("Hub status is {0}", mHub.getStatus()); mHub.setWorkMode(Hub.WorkMode.Polling); Debug.LogFormat("New work mode is {0}", mHub.getWorkMode()); bRunThreadRun = true; runThread = new Thread(new ThreadStart(runThreadFn)); runThread.Start(); ret = mHub.startScan(); Debug.LogFormat("startScan = {0}", ret); if (RetCode.GF_SUCCESS == ret) { lastlog = "BLE scan starting succeeded."; } else { lastlog = "BLE scan starting failed."; } }
public static SarResult Sar( int startIdx, int endIdx, double[] high, double[] low, double acceleration, double maximum) { int outBegIdx = default; int outNBElement = default; double[] outReal = new double[endIdx - startIdx + 1]; RetCode retCode = TACore.Sar( startIdx, endIdx, high, low, acceleration, maximum, ref outBegIdx, ref outNBElement, ref outReal); return(new(retCode, outBegIdx, outNBElement, outReal)); }
public static MovingAverageVariablePeriodResult MovingAverageVariablePeriod( int startIdx, int endIdx, double[] real, double[] periods, int minPeriod, int maxPeriod, MAType maType) { int outBegIdx = default; int outNBElement = default; double[] outReal = new double[endIdx - startIdx + 1]; RetCode retCode = TACore.MovingAverageVariablePeriod( startIdx, endIdx, real, periods, minPeriod, maxPeriod, maType, ref outBegIdx, ref outNBElement, ref outReal); return(new(retCode, outBegIdx, outNBElement, outReal)); }
public override IQueryable <T> Execute(RetCode retCode, Expression <Func <T, bool> > expression) { IQueryable <T> result = _unit.Repository <T>().Query(expression); SetRetCode(retCode, CommonCode.OK); return(result); }
public static BopResult Bop( int startIdx, int endIdx, double[] open, double[] high, double[] low, double[] close) { int outBegIdx = default; int outNBElement = default; double[] outReal = new double[endIdx - startIdx + 1]; RetCode retCode = TACore.Bop( startIdx, endIdx, open, high, low, close, ref outBegIdx, ref outNBElement, ref outReal); return(new(retCode, outBegIdx, outNBElement, outReal)); }
protected GenOneReqResult <int> Delete(RetCode retCode, MentalillnessToHospitalRecord model) { var result = new GenOneReqResult <int> { Result_01 = 0, RetCode = retCode }; #region 刪圖檔 _icoContext.Resolve <IServiceMTC>().DeleteFile(model.MedicalPersonImage); if (model.FormImage.HasValue) { _icoContext.Resolve <IServiceMTC>().DeleteFile(model.FormImage.Value); } #endregion if (GetAction <IRTDelete <MentalillnessToHospitalRecord> >().Execute(retCode, new List <MentalillnessToHospitalRecord> { model })) { SetRetCode(retCode, CommonCode.OK); } else { SetRetCode(retCode, CommonCode.DeleteDataFail, "id=" + model.Id.ToString()); } return(result); }
public static UltOscResult UltOsc( int startIdx, int endIdx, double[] high, double[] low, double[] close, int timePeriod1, int timePeriod2, int timePeriod3) { int outBegIdx = default; int outNBElement = default; double[] outReal = new double[endIdx - startIdx + 1]; RetCode retCode = TACore.UltOsc( startIdx, endIdx, high, low, close, timePeriod1, timePeriod2, timePeriod3, ref outBegIdx, ref outNBElement, ref outReal); return(new(retCode, outBegIdx, outNBElement, outReal)); }
public override GenOneReqResult <List <PoliceStation> > Execute(RetCode retCode, GenOneStringReqInParm request) { var result = new GenOneReqResult <List <PoliceStation> >() { RetCode = retCode }; try { if (int.TryParse(request.Text, out int id)) { var action = GetAction <IRTQuery <PoliceStation> >(); result.Result_01 = action.Execute(retCode, s => s.Id.Equals(id)).ToList(); } else { SetRetCode(retCode, CommonCode.ParameterError); } } catch (Exception ex) { Logger.Fatal(ex.Message); SetRetCode(retCode, CommonCode.Fail, ex.Message); } return(result); }
public static PlusDIResult PlusDI( int startIdx, int endIdx, double[] high, double[] low, double[] close, int timePeriod) { int outBegIdx = default; int outNBElement = default; double[] outReal = new double[endIdx - startIdx + 1]; RetCode retCode = TACore.PlusDI( startIdx, endIdx, high, low, close, timePeriod, ref outBegIdx, ref outNBElement, ref outReal); return(new(retCode, outBegIdx, outNBElement, outReal)); }
public static StochRsiResult StochRsi( int startIdx, int endIdx, double[] real, int timePeriod, int fastK_Period, int fastD_Period, MAType fastD_MAType) { int outBegIdx = 0; int outNBElement = 0; double[] outFastK = new double[endIdx - startIdx + 1]; double[] outFastD = new double[endIdx - startIdx + 1]; RetCode retCode = TACore.StochRsi( startIdx, endIdx, real, timePeriod, fastK_Period, fastD_Period, fastD_MAType, ref outBegIdx, ref outNBElement, ref outFastK, ref outFastD); return(new(retCode, outBegIdx, outNBElement, outFastK, outFastD)); }
public RetMsg(RetCode retCode, params string[] args) { this.retCode = retCode; StringBuilder sb = new StringBuilder(); for (int i = 0; i < args.Length; i++) { sb.Append(args[i]); if (i != args.Length - 1) sb.Append(", "); } this.ret_content = Encoding.ASCII.GetBytes(sb.ToString().Trim()); this.ret_content_len = this.ret_content.Length; }
internal static string RetcodeToString(RetCode retcode) { switch (retcode) { case RetCode.INVALID_HANDLE: return "INVALID_HANDLE"; case RetCode.SUCCESS: return "SUCCESS"; case RetCode.SUCCESS_WITH_INFO: return "SUCCESS_WITH_INFO"; case RetCode.NO_DATA: return "NO_DATA"; } return "ERROR"; }
// Helpers static internal OdbcErrorCollection GetDiagErrors(string source, OdbcHandle hrHandle, RetCode retcode) { OdbcErrorCollection errors = new OdbcErrorCollection(); GetDiagErrors(errors, source, hrHandle, retcode); return errors; }
internal static string RetcodeToString(RetCode retcode) { switch (retcode) { case RetCode.SUCCESS: return "SUCCESS"; case RetCode.SUCCESS_WITH_INFO: return "SUCCESS_WITH_INFO"; case RetCode.ERROR: return "ERROR"; case RetCode.INVALID_HANDLE: return "INVALID_HANDLE"; case RetCode.NO_DATA: return "NO_DATA"; default: Debug.Assert(false, "Unknown enumerator passed to RetcodeToString method"); goto case RetCode.ERROR; } }
static internal void GetDiagErrors(OdbcErrorCollection errors, string source, OdbcHandle hrHandle, RetCode retcode) { Debug.Assert(retcode!=ODBC32.RetCode.INVALID_HANDLE, "retcode must never be ODBC32.RetCode.INVALID_HANDLE"); if (RetCode.SUCCESS != retcode) { Int32 NativeError; Int16 iRec = 0; Int16 cchActual = 0; StringBuilder message = new StringBuilder(1024); string sqlState; bool moreerrors = true; while(moreerrors) { ++iRec; retcode = hrHandle.GetDiagnosticRecord(iRec, out sqlState, message, out NativeError, out cchActual); if ((RetCode.SUCCESS_WITH_INFO == retcode) && (message.Capacity-1 < cchActual)) { message.Capacity = cchActual+1; retcode = hrHandle.GetDiagnosticRecord(iRec, out sqlState, message, out NativeError, out cchActual); } //Note: SUCCESS_WITH_INFO from SQLGetDiagRec would be because //the buffer is not large enough for the error string. moreerrors = (retcode == RetCode.SUCCESS || retcode == RetCode.SUCCESS_WITH_INFO); if(moreerrors) { //Sets up the InnerException as well... errors.Add(new OdbcError( source, message.ToString(), sqlState, NativeError ) ); } } } }