Page 1 of 1

tmsquery.active=false after tmsquery.Open

Posted: Fri 13 Jan 2006 23:36
by haidomingo
Sorry for my bad english.

...
...
QSnAss.SQL.Clear;
QSnAss.SQL.Add('Select * From ListaSn');
QSnAss.MasterSource:=DSLineeDocumentoIn;
QSnAss.SQL.Add('WHERE (ListaSn.[Documento Acquisto]='
+QuotedStr (DocumentiNumeroDocumento.value)+')');
QSnAss.SQL.Add(' AND (ListaSn.IdArticoloInterno=:IdArticoloInterno)');
QSnAss.Execute;

the state of QSnAss.Active after execution this code is false, Why??
(SDAC 3.50)
Thanks

Posted: Mon 16 Jan 2006 13:34
by Ikar
Please specify for which reason you set MasterSource property.

Problem resolved

Posted: Mon 16 Jan 2006 15:14
by haidomingo
Ikar wrote:Please specify for which reason you set MasterSource property.
The reason: QSnAss is detail table

I have renamed QSnAss ---> SnDocumento and problem resolved:

SnDocumento.SQL.Clear;
SnDocumento.SQL.Add('Select * From ListaSn');
SnDocumento.SQL.Add('WHERE (ListaSn.IdDocIn=:IdDoc)');
SnDocumento.SQL.Add(' AND (ListaSn.IdArticoloInterno=:IdArticoloInterno)');
SnDocumento.paramByName('IdDoc').Value:=DocumentiIdDocumento.AsString;
SnDocumento.MasterSource:=DSLineeDocumentoIn;
SnDocumento.Execute;

Possible bug (TMSQuery.Name='QSnAss'?
Thanks

Posted: Tue 17 Jan 2006 07:25
by tinof
Hi,

sorry, it seems a little bit too easy but i want to post nevertheless :

Should you call the open() - method instead of execute() to get a resultset ?

Posted: Tue 17 Jan 2006 11:50
by Ikar
We don't think that the problem is in component name or in use of Execute method. Maybe there was an error in your first example.If you try to execute SQL code with error in syntax, QSnAss can't be Active neither using Execute method, nor Open method.