Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread Queries with parameters
Sat, Feb 16 2008 1:53 PMPermanent Link

Abdulaziz Jasser
Why do queries with parameters always return zero records?
Sat, Feb 16 2008 10:41 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Abdulaziz,

<< Why do queries with parameters always return zero records? >>

They don't. Smiley Could you give me a little more information as to your
situation ?  Version number, SQL that you're running, etc. ?

Thanks,

--
Tim Young
Elevate Software
www.elevatesoft.com

Sun, Feb 17 2008 1:18 PMPermanent Link

Abdulaziz Jasser
Tim,

<<They don't. Smiley Could you give me a little more information as to your
situation ?  Version number, SQL that you're running, etc. ?>>

I am facing this problem with a lot of quires.  This problem is happening with 1.07 & 1.08.  This is an example of an SQL:

SELECT InvoiceNo
FROM TB_Invoices
WHERE BranchSysNo = :iBranchSysNo
AND   YearSysNo   = :iYearSysNo
AND   InvoiceType = :iInvoiceType

ORDER BY InvoiceNo DESC


This is the way I am passing the paramteres:

qryMaster.Close;
qryMaster.ParamByName('iBranchSysNo').Value := rUserData.BranchSysNo;
qryMaster.ParamByName('iYearSysNo').Value   := rUserData.YearSysNo;
qryMaster.ParamByName('iInvoiceType').Value := iNormalSales;
qryMaster.Open;


If I put the values of the parameters inside the query then it works and return the right records.
Mon, Feb 18 2008 3:33 AMPermanent Link

"Harry de Boer"
Abdulaziz,

What happens if you use the paramtype:
qryMaster.ParamByName('iBranchSysNo').asInteger := rUserData.BranchSysNo;
etc.

Harry



"Abdulaziz Jasser" <jasser@cyberia.net.sa> schreef in bericht
news:26122449-49D9-44DB-AAEE-6063092D7FF2@news.elevatesoft.com...
> Tim,
>
> <<They don't. Smiley Could you give me a little more information as to your
> situation ?  Version number, SQL that you're running, etc. ?>>
>
> I am facing this problem with a lot of quires.  This problem is happening
with 1.07 & 1.08.  This is an example of an SQL:
>
> SELECT InvoiceNo
> FROM TB_Invoices
> WHERE BranchSysNo = :iBranchSysNo
> AND   YearSysNo   = :iYearSysNo
> AND   InvoiceType = :iInvoiceType
>
> ORDER BY InvoiceNo DESC
>
>
> This is the way I am passing the paramteres:
>
> qryMaster.Close;
> qryMaster.ParamByName('iBranchSysNo').Value := rUserData.BranchSysNo;
> qryMaster.ParamByName('iYearSysNo').Value   := rUserData.YearSysNo;
> qryMaster.ParamByName('iInvoiceType').Value := iNormalSales;
> qryMaster.Open;
>
>
> If I put the values of the parameters inside the query then it works and
return the right records.
>

Mon, Feb 18 2008 6:59 AMPermanent Link

Abdulaziz Jasser
Harry,

<<
What happens if you use the paramtype:
qryMaster.ParamByName('iBranchSysNo').asInteger := rUserData.BranchSysNo;
etc.>>


Thanks Harry for the reply.  However, I tried that before and did not help.
Mon, Feb 18 2008 3:58 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Abdulaziz,

<< I am facing this problem with a lot of quires.  This problem is happening
with 1.07 & 1.08.  This is an example of an SQL: >>

Did you try the same query in the ElevateDB Manager ?  It will handle
parameter population by prompting you with a dialog.

If that doesn't work, then please send me the database catalog
(edbdatabase.edbcat) and the tables that you're using and I'll take a look
here.

Thanks,

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Feb 19 2008 7:26 AMPermanent Link

Abdulaziz Jasser
Tim,

<<Did you try the same query in the ElevateDB Manager ?  It will handle
parameter population by prompting you with a dialog.>>

It works fine with EDB manager!!!  What could be wrong with my code?  It is a common problem in my application.  All quires with parameters do
not work.
Tue, Feb 19 2008 7:43 AMPermanent Link

Abdulaziz Jasser
I solved the problem by deleting those query components and placing a new one with the same query and everything and now it works fine!!!  Any
thoughts on what might be the problem.
Tue, Feb 19 2008 7:59 AMPermanent Link

Abdulaziz Jasser
You want believe it.  But I found the problem.  It was the extra spaces that were added to the query after installing Raize components.  Now Delphi
IDE uses Raize TStringList editor to edit the SQL property of the EDBQuery.  This somehow affects queries with parameters.  So all I had to do was
delete those extra spaces at the end of those queries.
Tue, Feb 19 2008 2:42 PMPermanent Link

Ray Konopka
Hi,

A little birdie told me about your post on this thread.  We haven't received any reports like this, and so we would like some more information about the exact steps that created the
problem so that we can address it in a future build.  Specifically, where exactly were the extra spaces added to the SQL property?  Also, does this only happen when you edit a SQL
property that already contains a query, or does it also happen when you populate the SQL property for the first time using the editor.  And one more thing, when you make the
change to the SQL property (in the editor) that causes the problem, what does the status bar in the Raize String List Editor show for the line count?

And finally, Raize Components does support dynamic component registration, which means that is possible to remove the Raize String List Editor without removing the entire library.
To do this, you need to create a new key in the Registry:  HKEY_CURRENT_USER\Software\Raize\Raize Components\4.0\Register
In this key, create a new String Value and name it "String List Editor" (without the quotes). And set it's Data value to 0. Then restart Delphi and the standard String List Editor will be
used.

Ray
--
Ray Konopka
Raize Software Support



Abdulaziz Jasser <jasser@cyberia.net.sa> wrote:

You want believe it.  But I found the problem.  It was the extra spaces that were added to the query after installing Raize components.  Now Delphi
IDE uses Raize TStringList editor to edit the SQL property of the EDBQuery.  This somehow affects queries with parameters.  So all I had to do was
delete those extra spaces at the end of those queries.
Page 1 of 2Next Page »
Jump to Page:  1 2
Image