🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

TQuery Param Binding

#1154
From: Roy Glunt
Date: Thu, 07 Oct 2004 15:59
31 lines
2294 bytes
I have a TQuery that is built at runtime with the following lin es of code.

    this->Query1->SQL->Clear();
    this->Query1->SQL->Add("SELECT DISTINCT NP.FILE_ID AS FILEID, P.NAME AS PSPNAME");
    this->Query1->SQL->Add("FROM PAYPHONES.PAYPHONE_NPCID NP, ");
    this->Query1->SQL->Add("PAYPHONES.PAYPHONE_NUMBERS NI,");
    this->Query1->SQL->Add("PAYPHONES.PAYPHONE_NUMBERYYYYQQ N, ");
    this->Query1->SQL->Add("PAYPHONES.PAYPHONE_PSP P, ");
    this->Query1->SQL->Add("PAYPHONES.PAYPHONE_FILE NF");
    this->Query1->SQL->Add("WHERE NP.NF_ID = NI.NF_ID");
    this->Query1->SQL->Add("AND NI.NUMBER_ID = N.NUMBER_ID");
    this->Query1->SQL->Add("AND NP.FILE_ID = NF.FILE_ID");
    this->Query1->SQL->Add("AND P.PSP_ID = NF.PSP_ID");
    this->Query1->SQL->Add("AND NI.NUMBER_STATUS = 100");
    this->Query1->SQL->Add("AND N.YEAR = :YEAR");
    this->Query1->SQL->Add("AND N.QUARTER = :QUARTER");

The ("AND N.YEAR = :YEAR");  database field is a varchar
and the ("AND N.QUARTER = :QUARTER"); is a varchar.

When the Params are assigend they are assigned as so.

    this->Query1->Params->Items[0]->AsInteger = StrToInt(this->ComboYYYY->Text);
    this->Query1->Params->Items[1]->AsInteger = StrToInt(this->ComboQQ->Text) ;

What I am wondering is when the bind is done does the the params get convereted to varchar since the fields in the database are varchar or does it leave it as integers?

Thanks,
Roy Glunt
Pac-West Telecomm Inc.
Technical Details
Message-ID: <416567eb$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,1b47912ae568d81b,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Roy Glunt" <rglunt@pacwest.com>
Sender: "Roy Glunt" <rglunt@pacwest.com>
Reply-To: "Roy Glunt" <rglunt@pacwest.com>
Subject: TQuery Param Binding
Newsgroups: borland.public.cppbuilder.database.ado
X-User-Info: 66.52.88.166     
X-Forwarded-For: 192.168.136.94
NNTP-Posting-Host: 207.105.83.66
Message-ID: <416567eb$1@newsgroups.borland.com>
Date: 7 Oct 2004 08:59:39 -0700
X-Trace: newsgroups.borland.com 1097164779 207.105.83.66 (7 Oct 2004 08:59:39 -0700)
Lines: 31
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail