Jump to content

bazzer747

Members
  • Content Count

    183
  • Joined

  • Last visited

Everything posted by bazzer747

  1. bazzer747

    Learning Delphi

    A great place to start is LearnDelphi.tv Lots of free video's to view, but the paid for videos look at the details of all components in the VCL.
  2. bazzer747

    Firedac and MariaDB

    Hi, I'm trying to connect to a MariaDB database. I have MariaDB v10.3.24 installed on a NAS Server (32bit version). I can access it using HeidiSQL and see my tables etc. But from Delphi I'm not. I have also loaded MariaDB onto my PC, same version (the 32 bit version) and can see this from HeidiSQL. In my TfdConnections I have the same parameters as I see from the HeidiSQL Session Manager, so I know they are correct. What I get (trying to access either instance of MariaDB) is a message 'Cannot load vendor library [...libmariadb.dll ...]. The specified module could not be found. Hint: check it is in the PATH or application EXE directories, and has x86 bitness..' Well, I do have libMariaDB.dll in the EXE directory, I also have it in the C:\Program Files (x86)\MariaDB 10.3\lib directory, and both these paths are set as search paths in the project options. It is also in the Windows PATH environmental variable. I'm sort of at a loss now as to what else I can do. The error message would appear to be giving wrong information
  3. bazzer747

    FireDac Batchmove

    Hi, I'm just testing Batchmove to backup my tables from a Live MSSQL server to a backup MSSQL server.. So I'm using a SQLReader & SQLWriter with the BatchMove component. However, when I execute the BatchMove it only copies over 100 records. I see no property that says 'copy every record'. I do see a 'CommitCount' property set at 100, and if I change that to, say, 200, I get 200 records copied. But reading about this property indicates it is about doing transactions in batches of this number to avoid possible limits. So I would have thought it would do 100, then the next 100 and so on to the end. Am I missing a property here which will default to copying the whole table over. I'm finding the FireDac DocWiki on this quite difficult to find answers like this.
  4. Hi, Whilst I've used Firedac for some while now I've never tried to use Interbase with it. My normal connectivity, both local and on remote servers, is using MSSQL. However, with some time on my hands I've decided to go through Cary Jensen's Delphi in Depth: FireDac book which uses Interbase throughout. But ... at the first hurdle I'm stopped. I've created a new VCL project with a data modele, and on it placed a FDConnection. In the parameters I've set it to a IB driver, pointed it to the EMPLOYEE.GDB, added User_Name and Password, and set Server to 127.0.0.1. When I Test this connection I get ..Unable to complete network request to host !localhost/305" ... target machine actively refused it. Googling this I've seen lots of different thoughts but few that pertain to Delphi 10.4.1/InterBase 2020 which I have installed or don't appear applicable. I've disabled my anti-virus products in case they were blocking this connection. Any suggestions would be appreciated - I'm not a Windows guru, which maybe is what is needed to allow this connection.
  5. bazzer747

    Target machine actively refused connection

    Finally got it working. I think the problem was twofold - first I had IB Server 'developer_ib2020' running, and 'gds_db' wasn't running. I brought up IB Console and added 'gds_db' and created a new User. Then when I ran my application it connected successfully. So another case of the error message not giving a clue as to where the problem lay. It was really that I'd never used the 'gds_db' server before and therefore it wasn't configured correctly for use. Still not sure technically why it didn't connect to the 'developer_ib2020' instance that was running.. Now I'm connected I'll dig deeper and maybe start to understand the configuration aspects of these different server instances. Thanks all who responded to help me out. Really appreciated.
  6. bazzer747

    Target machine actively refused connection

    Yes, the service is running. See snapshot above.
  7. bazzer747

    Target machine actively refused connection

    So I am only in development on my PC, so when I installed Interbase I accepted all the defaults. This is why I'm a bit surprised that it doesn't work. It isn't that I'm doing anything complicated. Connecting to MSSQL is so simple and works seamlessly, I've had no issues at all. Yet, with Interbase I am getting issues all the time. No wonder I'm deciding not to use IB 🙂 What I have noticed, looking at Services, is the path to the executable is it points to the ..Program Files (x86)\Embarcadero\Studio\20.0\InterBase2020" -p developer_ib2020. So not the 21.0 directory (which is the 10.4 install). Could this be an issue? Also, in the Log On tab there's a checkbox 'Allow service to interact with desktop' which was unchecked. Checking it makes no difference. I'm thinking a good old uninstall/re-install to see if the previous installations have cross-contaminated each other ...
  8. bazzer747

    Target machine actively refused connection

    Hi, Yes, I have Interbase Server running - called developer_ib2020. And in the FDConnection it's almost exactly like yours: I did changed Protocol from 'local' to TCP/IP but made no difference (and Server from localhost to 127.0.0.1). On your last point - VendorHome and VendorLib properties, which DLL are you referring to?
  9. bazzer747

    FireDac Batchmove

    Hi, Thankyou for all the responses. This always encourages me to continue testing and following advice to get things working. As mentioned above, I have now setup a new project whose sole purpose is to copy records from a table on one server to a 'backup' table on a different server. I started with the TFDManager as recommended above (although I'm led to believe one is created in the background anyway). And it does work. All records are copied over successfully. So the problem I'm having in my original project isn't solved, but at least I can't suspect the components any longer, it must be how they are set up. Some more checking here! I'm not into spending on 3rd party tools to do what FireDac promises to do, I'm not into that world, mores the pity.
  10. bazzer747

    FireDac Batchmove

    Hi, Thanks for suggestions, but I'm talking about MSSQL Servers that are available to me from a Web hosting company, and this functionality isn't available to me. When I ask them about making backups they say I need to manage that functionality myself. They ensure their Servers are backed up, rest is up to Users. Maybe it's different with other hosting companies..
  11. bazzer747

    FireDac Batchmove

    Something else which seems amiss :-): What I really want to do is make backups of tables on a Live server and write them to tables on a different, backup server. Ignoring for a second the above issue, when I set up the SQLReader and SQLWriter to use the same TFDConnection, hence the same Server, it woks OK. When I set the SQLReader to point to the Live Server and the SQLWriter to a different backup Server I get an Access Violation! I'll start a totally new/clean project just to try this configuration, as I can't see why what I am trying here shouldn't work, it just makes better sense when making backups for them to on a totally different Server.
  12. bazzer747

    FireDac Batchmove

    Hi Roger, Yes, the TFDQuery, FetchOptions, AutoFetchAll is set to afAll. It looks like it gets this value from the TFDConnection, like the RowSetSize as I didn't have to change anything. And on the Pawel video, yes I looked at that to set my test up. I'll start it from the start again, though, as I jumped in n to just the BatchMoive bbits.
  13. bazzer747

    FireDac Batchmove

    I have Fetch Mode set to fmAll in FetchOptions.
  14. bazzer747

    OnClick Oddity

    Hi In a window I have a 'floating' panel (calledpanEdit)that follows the items in a dbgrid. On some occasions I don't want to see that panel. Elsewhere I have an edit field and on it's OnClick event I have: panEdit.Visible:= False; which works fine, making the panEdit panel invisible. However, that's not so good in design terms as I have to enter this edit field to make the panel invisible. So I have put another panel on the form, made it effectively invisible by not showing borders and colouring it the same as the background. On it's OnClick event I've put the same code to make panEdit invisible. But it doesn't! I follow the code in debug mode and when I click on this panel it goes to the OnClick event, runs the panEdit.Visible:= False code, but does nothing. Am I missing something here? There's an OnClick event for a panel and it runs the code but doesn't run the code, if you see what I mean. I've put a ShowMessage('Hello there') in the OnClick event and that shows, so it is running that code, but ignoring, the panEdit.Visible:= False; code.
  15. bazzer747

    OnClick Oddity

    Hi Many thanks for this advice. I think over the years I've just picked up bits of code and manipulated it to do what I want it to do and fallen into this 'separation' trap. With most of my projects not accessing tens of thousands of records there have been no time penalties in some code being run lots of times when there is no need so that hasn't been an issue for me. But I'll certainly start to look to do what I want outside of the drawing event.
  16. bazzer747

    OnClick Oddity

    Please explain why you say that. I change colour and font in the drawing event, why not make a panel visible or invisible, if that is what is needed.
  17. bazzer747

    OnClick Oddity

    Darn! Found the problem. I have code in the dbgrids OnDrawColumnCell event which sets the panel visibility to True, and this is getting run after I click the other panel. Not sure why it should do this but I traced it in the OnDrawColumnCell event.
  18. bazzer747

    DecodeDate Issue

    Hi, I have a project where I need to get the value of a year in a field so I use DecodeDate( dtDate, Year, Month, Day); where dtDate is a TDateTime variable, Year, Month, Day are Word variables. When I run the code I get an error - 'Constant or type identifier expected'. I've downloaded the example Embarcadero have for using DecodeDate: procedure TfAccounts.Button1Click(Sender: TObject); var Present: TDateTime; Year, Month, Day: Word; begin Present:= Now; System.SysUtils.DecodeDate(Present, Year, Month, Day); Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month ' + IntToStr(Month) + ' of Year ' + IntToStr(Year); end; .. and get this same error. The 'Word' is red-underlines as the error. I have System.SysUtils in the Uses clause: uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, ... etc I have used this same code in a different project and it works with no error. I can't think of why it isn't working in this particular project. Unless some other unit in the Uses clause is causing a problem, although SysUtils comes almost first. Any thoughts would be welcomed.
  19. bazzer747

    DecodeDate Issue

    Hi, Yes, thanks. I actually used this: cYear:= AnsiRightStr(DateToStr(dDate),4); when Decode wasn't behaving. Probably not as resilient as dependant on date format, I suppose, but works OK. Nice to think there are several ways to achieve a result.
  20. bazzer747

    DecodeDate Issue

    version 10.4.1 Found the answer!!! Grrhhh, silly me. I have a status bar on the form using it to write various things happening. I'd called it 'word' would you believe! Changed it to SayWord and all works fine.
  21. bazzer747

    Date Sorting Odd

    I have a MSSQL table of financial transactions and I retrieve the data with a FDQuery which has the following statement: 'SELECT * FROM tAccounts ORDER BY AccName, TxnDate, Deposit' And executing that from the TFDQuery gives the correct results - a list in Account order and within that date order. See attached SQLView.jpg, specifically records 501 and 502 (correct date order). However, when I view this same table in a DBGrid in my application, the order is not the same. See attached DBGView.jpg, note the 20 Feb is before 17th Feb. The field is a Date datatype and there is no alteration to the Select statement anywhere in the application. The DBGrid is the first thing shown in the application and neither Formcreate or FormActivate do anything to alter the data returned. This 'mis-sorting' shows on several other of the records and my thinking is that in the DBGrid the TxnDate field is sorted in yyyy-mm-dd order, as in '20210217', which numerically comes before '20210220'. So this is what's happening, it seems, but why, when the SQL returns the data in the correct order does the DBGrid 're-sort' in a numeric fashion?
  22. bazzer747

    Date Sorting Odd

    Oops! My bad .... just seen at sometime in the past I set IndexFieldNames on the query to the 'ID' field. Took it off, voila sort is good. I set that field when I was testing the locate functionality to help speed up finding a record. I can do that in code now switching it on or off when necessary. Sorry for asking too quickly ....
  23. bazzer747

    Date Sorting Odd

    Ahh, just found something that might explain something! I have another field called 'ID' - this is a auto-incrementing field to ensure uniqueness of my records. If I show this ID field in the DBGrid then it is clear the order is in 'ID' order! Why should this be, as the Select statement doesn't specify the ID field as something to sort on. However, I did make this field a Key field when I set the table up. Is this the problem? The DBGrid (for some reason) uses the Keyfield to display data rather than what the Select statement tells it to?
  24. bazzer747

    Macro substitution in Locate

    Hi, I'm aware that you can use a macro substitution in a select statement when you don't know some value until runtime (like a fieldname). If there a similar function that can be used in a Locate? I am developing a 'Search' on an accounts program where the user first selects a fieldname in which he looks for a value, maybe a 'Payee' fieldname or an 'Account' fieldname or a 'Deposit' fieldname. So the field on which to conduct the locate isn't known until runtime. A usual locate might look like this: if fdqA.Locate('Payee', cPayee ), []) then ShowMessage('Located!') else ShowMessage('Failed!'); But the user might want to search on 'Account' or 'Deposit'.
  25. bazzer747

    Filter on InternalCalc field

    Hi I have a table with a field called 'cTaxYear', which is created as an Internal Calculated field (fkInternalCalc), it's a 7 character string field and contains, for instance, '2008-09', being a tax year (here in the UK) from 7Apr2008 to 6Apr2009. The calculation is based on the date a dividend is paid out and works out what tax year that dividend falls into. It works perfectly well in dbgrids etc. However, when I try to create a filter, for instance to filter all the records with a tax year of '2008-09' the dbgrid displays nothing. There are about 150 records which do contain '2008-09' in the 'cTaxYear' field and the filter expression is 'cTaxYear = ' + QuotedStr( '2008-09' ); Reading about filters I see it says 'Only the fkInternalCalc and fkAggregate fields can be used in filtering, sorting, or locating operations....' (which is why I created an fkInternalCalc field)) but says nothing more about any settings that should be used (like maybe setting indexfieldnames). Does anyone know for sure that an InternalCalc field can actually be used in a filter expression? Or if it definitely can't?
×