ADOQuery Command Text does not return a result set - ADO DAO RDO RDS

This is a discussion on ADOQuery Command Text does not return a result set - ADO DAO RDO RDS ; Hi I have this code ADOQ2.Active:=False; ADOQ2.Close; ADOQ2.SQL.Clear; sqlFill := ''; sqlFill := ('UPDATE Izpisi '); sqlFill := sqlFill+(' Set DATA = '''+AdoTable1.FieldByName('data').AsString+'''' ); sqlFill := sqlFill+('WHERE IZPISTIP = 1'); ADOQ2.SQL.Add(sqlFill); ADOQ2.ExecSQL; ADOQ2.Active:=True; and I get this error message: Command ...

+ Reply to Thread
Results 1 to 8 of 8

ADOQuery Command Text does not return a result set

  1. Default ADOQuery Command Text does not return a result set

    Hi
    I have this code
    ADOQ2.Active:=False;
    ADOQ2.Close;
    ADOQ2.SQL.Clear;
    sqlFill := '';
    sqlFill := ('UPDATE Izpisi ');
    sqlFill := sqlFill+(' Set DATA =
    '''+AdoTable1.FieldByName('data').AsString+'''' );
    sqlFill := sqlFill+('WHERE IZPISTIP = 1');
    ADOQ2.SQL.Add(sqlFill);
    ADOQ2.ExecSQL;
    ADOQ2.Active:=True;


    and I get this error message: Command Text does not return a result set

    what is the problem?




  2. Default Re: ADOQuery Command Text does not return a result set

    Hi Leposava,

    > I have this code
    > ADOQ2.Active:=False;
    > ADOQ2.Close;
    > ADOQ2.SQL.Clear;
    > sqlFill := '';
    > sqlFill := ('UPDATE Izpisi ');
    > sqlFill := sqlFill+(' Set DATA =
    > '''+AdoTable1.FieldByName('data').AsString+'''' );
    > sqlFill := sqlFill+('WHERE IZPISTIP = 1');
    > ADOQ2.SQL.Add(sqlFill);
    > ADOQ2.ExecSQL;


    This will execute the query, once, and not expecting a result set.

    > ADOQ2.Active:=True;


    This will re-execute the query again, expecting a result set.
    You should not set Active to True (or False again) when using with
    UPDATE (or INSERT/DElETE) commands that to not return result sets.
    ExecSQL is enough, although you can also use the Execute method of the
    TADOConnection component (without the need of a TADOQuery component).

    Groetjes,
    Bob Swart

    --
    Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
    CodeGear Technology Partner -- CodeGear RAD Studio Reseller (BeNeLux)
    Delphi Win32 & .NET books on Lulu.com: http://stores.lulu.com/drbob42
    Personal courseware + e-mail support http://www.ebob42.com/courseware
    Blog: http://www.drbob42.com/blog - RSS: http://eBob42.com/weblog.xml

  3. Default Re: ADOQuery Command Text does not return a result set

    Hi

    although you can also use the Execute method of the
    > TADOConnection component (without the need of a TADOQuery component).
    >

    when I use ADOConnection1.Execute('UPDATE Izpisi Set DATA =
    '''+SourceString+''', NAZIVIZP = ''Promet enega delavca'' WHERE IZPISTIP =
    1');

    it doesnt save S as it is instead of 'S' it writes 'L?' what is the
    problem ? by the way here is the full procedure


    procedure TForm1.Button7Click(Sender: TObject);
    var
    SourceString: string;
    MemoryStream: TMemoryStream;
    sqlFill:String;
    begin

    frxReport2.DesignReport;
    //MemoryStream := TMemoryStream.Create;
    MemoryStream:= TMemoryStream.Create;

    try

    //SourceString:= 'Leposava';
    // frxReport1.Designer.Report.SaveToStream(StringStream);
    frxReport2.SaveToStream(MemoryStream);
    MemoryStream.Position := 0;

    SetLength(SourceString, MemoryStream.Size);
    MemoryStream.ReadBuffer(Pointer(SourceString)^, MemoryStream.Size);
    finally
    MemoryStream.Free;
    end;

    showmessage(SourceString);


    ADOConnection1.Execute('UPDATE Izpisi Set DATA =
    '''+SourceString+''', NAZIVIZP = ''Promet Senega delavca'' WHERE IZPISTIP =
    1');


    end;



    "Bob Swart" <Bob@eBob42.com> wrote in message
    news:4836B84C.1080507@eBob42.com...
    > Hi Leposava,
    >
    >> I have this code
    >> ADOQ2.Active:=False;
    >> ADOQ2.Close;
    >> ADOQ2.SQL.Clear;
    >> sqlFill := '';
    >> sqlFill := ('UPDATE Izpisi ');
    >> sqlFill := sqlFill+(' Set DATA =
    >> '''+AdoTable1.FieldByName('data').AsString+'''' );
    >> sqlFill := sqlFill+('WHERE IZPISTIP = 1');
    >> ADOQ2.SQL.Add(sqlFill);
    >> ADOQ2.ExecSQL;

    >
    > This will execute the query, once, and not expecting a result set.
    >
    >> ADOQ2.Active:=True;

    >
    > This will re-execute the query again, expecting a result set.
    > You should not set Active to True (or False again) when using with UPDATE
    > (or INSERT/DElETE) commands that to not return result sets. ExecSQL is
    > enough, although you can also use the Execute method of the TADOConnection
    > component (without the need of a TADOQuery component).
    >
    > Groetjes,
    > Bob Swart
    >
    > --
    > Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
    > CodeGear Technology Partner -- CodeGear RAD Studio Reseller (BeNeLux)
    > Delphi Win32 & .NET books on Lulu.com: http://stores.lulu.com/drbob42
    > Personal courseware + e-mail support http://www.ebob42.com/courseware
    > Blog: http://www.drbob42.com/blog - RSS: http://eBob42.com/weblog.xml




  4. Default Re: ADOQuery Command Text does not return a result set


    "Leposava Knez" <leposava.knez@tref.si> сообщил/сообщила в новостях
    следующее: news:4836b68d$1@newsgroups.borland.com...
    > Hi
    > I have this code
    > ADOQ2.Active:=False;
    > ADOQ2.Close;
    > ADOQ2.SQL.Clear;
    > sqlFill := '';
    > sqlFill := ('UPDATE Izpisi ');
    > sqlFill := sqlFill+(' Set DATA =
    > '''+AdoTable1.FieldByName('data').AsString+'''' );
    > sqlFill := sqlFill+('WHERE IZPISTIP = 1');
    > ADOQ2.SQL.Add(sqlFill);
    > ADOQ2.ExecSQL;
    > ADOQ2.Active:=True;
    >
    >
    > and I get this error message: Command Text does not return a result set
    >
    > what is the problem?

    1. It is strongly advised to use Parameters or at least QuotedStr function
    for supplying values into SQL
    2. Remove "ADOQ2.Active:=True;" since ADOQ2 holds Update query but not
    Select query.



  5. Default Re: ADOQuery Command Text does not return a result set

    now I have this code
    and still ╘ is converted to L? what may be the problem?


    procedure TForm1.Button10Click(Sender: TObject);
    var
    SourceString: string;
    StringStream : TStringStream;
    sqlFill:String;
    begin

    frxReport3.DesignReport;
    //MemoryStream := TMemoryStream.Create;
    StringStream:= TStringStream.Create(SourceString);

    try

    frxReport3.SaveToStream(StringStream);
    StringStream.Position := 0;

    SetLength(SourceString, StringStream.Size);
    StringStream.Read(Pointer(SourceString)^, StringStream.Size);
    finally
    StringStream.Free;
    end;

    AdoTable10.Edit;
    AdoTable10.FieldByName('data').AsString := SourceString;

    ADOQRazno.Active:=False;
    ADOQRazno.SQL.Clear;
    sqlFill := '';
    sqlFill := ('UPDATE Izpisi ');
    sqlFill := sqlFill+(' Set DATA = arData ');
    sqlFill := sqlFill+(' WHERE IZPISTIP = 1 ');
    ADOQRazno.SQL.Add(sqlFill);
    ADOQRazno.Parameters.ParamByName('parData').DataType := ftString;
    ADOQRazno.Parameters.ParamByName('parData').Value:=
    AdoTable10.FieldByName('data').AsString;
    ADOQRazno.Parameters.ParamByName('p1').DataType := ftInteger;
    ADOQRazno.Parameters.ParamByName('p1').Value:= 1;
    ADOQRazno.ExecSQL;

    end;



  6. Default Re: ADOQuery Command Text does not return a result set

    can someone please help me?


    "Leposava Knez" <leposava.knez@tref.si> wrote in message
    news:483bb140@newsgroups.borland.com...
    > now I have this code
    > and still ╘ is converted to L? what may be the problem?
    >
    >
    > procedure TForm1.Button10Click(Sender: TObject);
    > var
    > SourceString: string;
    > StringStream : TStringStream;
    > sqlFill:String;
    > begin
    >
    > frxReport3.DesignReport;
    > //MemoryStream := TMemoryStream.Create;
    > StringStream:= TStringStream.Create(SourceString);
    >
    > try
    >
    > frxReport3.SaveToStream(StringStream);
    > StringStream.Position := 0;
    >
    > SetLength(SourceString, StringStream.Size);
    > StringStream.Read(Pointer(SourceString)^, StringStream.Size);
    > finally
    > StringStream.Free;
    > end;
    >
    > AdoTable10.Edit;
    > AdoTable10.FieldByName('data').AsString := SourceString;
    >
    > ADOQRazno.Active:=False;
    > ADOQRazno.SQL.Clear;
    > sqlFill := '';
    > sqlFill := ('UPDATE Izpisi ');
    > sqlFill := sqlFill+(' Set DATA = arData ');
    > sqlFill := sqlFill+(' WHERE IZPISTIP = 1 ');
    > ADOQRazno.SQL.Add(sqlFill);
    > ADOQRazno.Parameters.ParamByName('parData').DataType := ftString;
    > ADOQRazno.Parameters.ParamByName('parData').Value:=
    > AdoTable10.FieldByName('data').AsString;
    > ADOQRazno.Parameters.ParamByName('p1').DataType := ftInteger;
    > ADOQRazno.Parameters.ParamByName('p1').Value:= 1;
    > ADOQRazno.ExecSQL;
    >
    > end;
    >
    >




  7. Default Re: ADOQuery Command Text does not return a result set

    "Leposava Knez" <leposava.knez@tref.si> wrote in message
    news:483cf5b0$1@newsgroups.borland.com...
    > can someone please help me?
    >


    You need to be more specific about what the problem is.



  8. Default Re: ADOQuery Command Text does not return a result set

    I fonund what was the problem the database language wasnt set

    "Kevin Frevert" <kevin@workdrinkingicewater.com> wrote in message
    news:483d523d@newsgroups.borland.com...
    > "Leposava Knez" <leposava.knez@tref.si> wrote in message
    > news:483cf5b0$1@newsgroups.borland.com...
    >> can someone please help me?
    >>

    >
    > You need to be more specific about what the problem is.
    >




+ Reply to Thread