🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1827

Re: conflict with ado and teechart

#1827
From: Viatcheslav V. Vassiliev
Date: Tue, 10 Feb 2004 15:57
148 lines
5147 bytes
What DBMS you are using? Could you reproduce this with standard MS SQL
Server database (pubs, northwind) or with MS Access database (small)?

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Walter" <w@w.w> �������/�������� � �������� ���������:
news:4028ef04@newsgroups.borland.com...
> Here is my stripped down code that replicates the error
>
> header file
> =======
>
>
file://---------------------------------------------------------------------
> ------
>
> #ifndef PlotH
> #define PlotH
>
file://---------------------------------------------------------------------
> ------
>
> #include <Classes.hpp>
> #include <Controls.hpp>
> #include <StdCtrls.hpp>
> #include <Forms.hpp>
> #include <Chart.hpp>
> #include <ExtCtrls.hpp>
> #include <Series.hpp>
> #include <TeEngine.hpp>
> #include <TeeProcs.hpp>
> #include <ComCtrls.hpp>
> #include "test.h"
> #include <ADODB.hpp>
> #include <DB.hpp>
>
//--------------------------------------------------------------------------
> -
> class TPlotForm : public TForm
> {
> __published: // IDE-managed Components
>   TButton *calcButton;
>   TChart *Chart1;
>   TLineSeries *Series1;
>   TADOConnection *ADOConnection1;
>   TADODataSet *DataSet;
>   void __fastcall calcButtonClick(TObject *Sender);
>
> private: // User declarations
>   double PriceBond(AnsiString BondName,bool useNewrfr, double newRfr);
> public:  // User declarations
>   __fastcall TPlotForm(TComponent* Owner);
> };
>
//--------------------------------------------------------------------------
> -
> extern PACKAGE TPlotForm *PlotForm;
>
//--------------------------------------------------------------------------
> -
> #endif
>
> cpp file
> =====
> #include <vcl.h>
> #pragma hdrstop
>
> #include "Plot.h"
>
//--------------------------------------------------------------------------
> -
> #pragma package(smart_init)
> #pragma resource "*.dfm"
> TPlotForm *PlotForm;
>
//--------------------------------------------------------------------------
> -
> __fastcall TPlotForm::TPlotForm(TComponent* Owner)
>   : TForm(Owner)
> {
> }
>
//--------------------------------------------------------------------------
> -
> void __fastcall TPlotForm::calcButtonClick(TObject *Sender)
> {
>
>   double startVal, endVal, Steps;
>   startVal = 0.50;
>   endVal = 0.51;
>   Steps = 0.01;
>   double xVal[5];
>   double yVal[5];
>   int counter = 1;
>   xVal[0] = startVal;
>   while ( xVal[counter-1] < endVal )
>     {
>       xVal[counter] = xVal[counter-1]+Steps;
>       counter++;
>     }
>   AnsiString bondName = "TestBond";
>   double tempValue = 0;
>   double temp;
>   for (int i = 0; i < counter; i++)
>     {
>       yVal[i] = PriceBond(bondName,true, xVal[i]);
>     }
>   Chart1->Series[0]->Clear();
>   for (int i = 0; i<counter; i++){
>     Chart1->Series[0]->AddXY(xVal[i],yVal[i]);}
>  }//error occurs here
>
//--------------------------------------------------------------------------
> -
> double TPlotForm::PriceBond(AnsiString BondName, bool useNewrfr, double
> newRfr)
> {
>   ADOConnection1->Connected = false;
>   ADOConnection1->Connected = true;
>   DataSet->CommandText = "select * from bond where ID=\""+BondName+"\"";
>   DataSet->Open();
>   double nominal = DataSet->FieldByName("Nominal")->AsString.ToDouble();
>   file://if this is true, error occurs
>   bool useYieldCurve= DataSet->FieldByName("UseYieldCurve")->AsBoolean;
>   double riskFreeRate;
>   if (!useYieldCurve)
>     riskFreeRate = DataSet->FieldByName("RiskFreeRate")->AsFloat;
>   DataSet->Close();
>   double rfr;
>     if (useNewrfr)
>       rfr = newRfr;
>     else
>       rfr = riskFreeRate;
>   double Value;
>   if (!useYieldCurve)
>     Value = rfr*nominal;
>   else Value = nominal*2;
>   ADOConnection1->Connected = false;
>   return Value;
> }
>
>
Technical Details
Message-ID: <4028ff73@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4028c5df@newsgroups.borland.com> <4028ef04@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,d6189872bf4664cd
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-02-10 08:10:32 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <4028c5df@newsgroups.borland.com> <4028ef04@newsgroups.borland.com>
Subject: Re: conflict with ado and teechart
Date: Tue, 10 Feb 2004 18:57:35 +0300
Lines: 150
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 213.234.218.42
Message-ID: <4028ff73@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076428659 213.234.218.42 (10 Feb 2004 07:57:39 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail