Jump to content

bazzer747

Members
  • Content Count

    195
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by bazzer747


  1. That doesn't work - I get the same message when it tries to run aQueryname.Close

     

    I'm using Firedac for these commands, I've used this shorthand version of opening a query with a new SQL many times with no problem. Just annoying the error message is so unhelpful, almost saying you can't open this until you open it!

     

    The old fashioned filtering works fine; I'll try the param setting in the query and see if that works better. Thanks for replying.


  2. Hi,

    When I open my project I cycle through all the queries I use making sure they are all active, this works fine.

     

    Depending on what year I want to view I have a radio box with '2019' and '2020' as selections and from that I need to 'filter' the data to only show the year chosen., I load the value into cYear. So I have this line:

     

    qQueryname.Open( 'SELECT * FROM tTablename WHERE mYear = :pY ORDER BY eDate',[ cYear ] );

     

    When this line is executed I get the error message above on this query, which is confusing me as it is an 'Open' command. The weirder thing is that the SQL is executed OK and the resulting data is the correct year's data.

     

    Using: Filtered:= False; Filter:= 'MatchYear = ' + cYear; Filtered:= True; code instead works perfectly with no issues.


  3. Hi

    I'm having great difficulty in getting the syntax correct on a query I need to make via a Firedac Q!uery.

     

    Basically I want to set a WHERE clause that picks up all records that have a 'S' or 'R' in a certain field.

    In 'normal' SQL this codes like this:

     

     SELECT  * FROM  tTableName WHERE  Status IN ('S', 'R') ORDER BY EventDate

     

    ... which works fine on the SQL Server, but how do I do this via a Firedac query?

    It may look something like this:

     

    qQueryName.Open('SELECT * FROM tTableName WHERE Status IN  :pSR ORDER BY EventDate',[ ('S','R') ] );

     

    The issue is how do I format the parameter - the above doesn't work, nor any of the different ways I can think of of setting the parameter to 'S','R'.

     

    Any help would be appreciated.


  4. A client has several of the applications I've written over the past several years and all work OK, They all connect (with FireDac) to a Microsoft SQL Server.

     

    However, I've just loaded a newer application (compiled in Delphi 10.3.3) and when I run it on this PC I get the following FireDac error message immediately (see attached):

     

    Exception EMSSQLNativeException in module ... at .....

    [FireDAC][Phys][ODBC][Microsoft][ODBC SQL Server Driver]Connection

    is busy with results for another hstmt

     

    The PC is not running any other application that could be accessing the MS SQL Server, so I'm at a loss as to why it is busy at all. This application works fine on my development machine. 

     

    Would this be a driver issue, maybe a newer driver is needed (is there one)? Or does Delphi 10.3.3/FireDAC do something differently to what it did in earlier versions?

     

    Any thoughts would be much appreciated.

    FiredacError.jpg


  5. Arrgghhh! I've spotted the error. In the code I had 

    fViewSignups.Create( Self );

     

    Should be: fViewSignups:= tfViewSignups.Create( Self );

     

    Silly type error, can't see the woods for the trees sometimes ... Works fine now.


  6. Hi

    I've created a new Windows VCL application and on the first form I've added several buttons, each buttons click event opens a new form. Three of these forms are OK, I've added various components (buttons, navigators, grids etc) but on the last I opened has no components on it except a button (called btnClose) which simply closes the form.

     

    However, when I run the application and press the button that opens this form I get an error message: 'A component named btnClose already exists'. After selecting the OK to this error, if I click the same button again the application freezes and I use Task Manager to kill it. If I click the other buttons, they open their forms fine, but if I then click on the 4th one again I get 'Invalid pointer operation'. This is the form in text:

     

    object fViewSignups: TfViewSignups
      Left = 0
      Top = 0
      Caption = 'View Signups'
      ClientHeight = 299
      ClientWidth = 678
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      PixelsPerInch = 96
      TextHeight = 13
      object btnClose: TRzButton
        Left = 520
        Top = 40
        Caption = 'Close'
        TabOrder = 0
        OnClick = btnCloseClick
      end
    end

     

    ... no duplicate btnClose, also see attached screenshot. I created this form with:

     

    procedure TfMain.RzButton2Click(Sender: TObject);
    begin
        fViewSignups.Create( Self );
        try
          fViewSignups.Showmodal;
        finally
          fViewSignups.Free;
        end;
    end;
     

    Which is identical to the way I created the other 3 forms which all work OK. I've closed everthing down and restarted everything and can't think of anythging else to look at to see where or why this error is happening. This is the first Windows application I've created since upgrading to Delphi 10.3.3, which may be something.

     

    Any thoughts on what else I can do would be appreciated.

     

     

    btnCloseIssue.jpg


  7. Does anybody know where I can find a (simple) example of setting up a Master-Detail on two tables (MSSQL in my case)? 

     

    All I can find via the internet are either overly complicated examples or in non-English languages. The Help in Delphi/Firedac is the former and very difficult to follow.


  8. Hi David,

     

    That's interesting, I'll make a note of this when they go to 10.4. I'm always having issues with upgrading. I don't mind a complete uninstall/reinstall if the upgrade is a major one with most of the files having been changed, but a 10.3.2 to 10.3.3 seems a very minor one. Why they can't just do a replace of the files updated (like most other software vendors do) I don't know. Smacks of laziness to me.


  9. Hi Vandrovnik,

    After your post I wondered about the next error, assuming it was caused by my renaming the file. However, it wasn't (I took snapshots), it was for another file in a different plug-in. So I went back and tried the same again (renaming the file). And this time the install worked OK!

     

    So your answer was correct and it was my 'assumptions' that stopped me figuring this out first time. Many thanks for spurring me on.


  10. Hi

    I have a plug-in (Konopka VCL) that shows it is being loaded at startup of Delphi (10.3.3), but which isn't working correctly. The GetIt package Manager doesn't show that this plug-in is installed so doesn't have an 'uninstall' option. It does have the 'install' option, but when I try this it fails when trying to copy files which are held by another process (presumably Delphi since it 'loaded' the plug-in at start - see attached screenshot).

     

    So for some reason it's got itself in a catch 22 state! I can neither use the plug-in nor uninstall it nor re-install it. I imagine I can uninstall the whole of Delhi and start again, but I'm wondering if there is a way to tell Delphi NOT to load that plug-in? If I can do that then maybe GetIt will install the plug-in without an error.

     

    Another option would be to run GetIT outside of Delphi, then it might work because Delphi would not be holding on to any files that would stop the copy process.

     

    Any thoughts would be useful.

    KonopkaError Install.jpg


  11. Yes. 10.3.1 is just as bad. Doesn't anybody in Embarcadero read these posts and think 'Ah, an issue that bugs our community, I'll get it fixed'? I guess not as it never does. Not the only thing that never seems to work in new releases. Like try 'Tutorials' and click 'See more Snippets'. A blank screen!


  12. Hi,

     

    Many thanks for all suggestions., I done a lot more thinking of my problems and come up with the following code:

    procedure ConnectLiveTest( fdc: String );
    var i: Integer;
    begin
    for i :=  0 to dm.ComponentCount -1 do
      if dm.Components[ i ] is TFDQuery then
      begin
        if fdc = 'Live' then
        TFDQuery( dm.Components[ i ]).Connection:= dm.fdcLive1
        else
        TFDQuery( dm.Components[ i ]).Connection:= dm.fdcTest1;

        TFDQuery( dm.Components[ i ]).Active    := True;
      end;
    end;

    This allows me to quickly switch between Test and Live MSSQL Server databases. And (whilst I'm still testing) appears to work OK.


  13. In my application I have a Data Module which has 2 FD Connections (one for Test site one for Live site) and over 20 FDQueries for all the tables and views (I connect to MS SQL Servers). My application fails quite regularly with error saying cannot access a closed dataset, and I think it is because at some stage I've used ExecSQL to insert or update a record and this appears to change the query in the FDQ. Which means I'm having to re-specify the sql query in code several times throughout the application.

     

    It seems to me that this isn't very good coding/design. I can't use the FDCExecSQL command as I'm flipping between the Test and Live connections, again I feel this isn't the right way to do this.

     

    If anybody can suggest a better way to manage my connectivity to avoid having to re-specify queries I would be very grateful.

×