

Gary
Members-
Content Count
100 -
Joined
-
Last visited
Community Reputation
12 GoodTechnical Information
-
Delphi-Version
Delphi 11 Alexandria
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
I would agree with Stano! However, this means you need to install 3rd party packages. You will need Data Access components. Zeos is popular. You will need to install and learn Firebird. Firebird and Interbase have the same roots. They were forked from same source some time ago. Embarcadero continues to develop it as commercial software, even if the community edition lets you build with IBLite, you will need to pay a license to use it outside the IDE. Firebird.org continues on the open source version. I believe they just released version 5? I did some projects with Firebird. They still work, but I personally find it difficult to work with. No doubt it is my lack of experience. I'm sure there is freeware that can at least export your old data to a .csv file, then as Stano said you can use FireDac BatchMove component to import into your Database of choice. I just added this feature to the one and only commercial app I have. It downloads GPS data in .csv format from the company's vehicle tracking service and imports it into a MYSQL Database.
-
What version of Delphi are you using? I have Pro + Devart Data Access components. Pro edition supports SQLite & Interbase Lite with Firedac out of the box, but not client/server (MySQL, Oracle..), not sure if the community edition supports any Databases. If you are using a trial edition Database support will end. If community edition supports SQLite I wouldn't discount it so fast, especially if you want to do any mobile apps. I'm trying to decide to use it or IBLite that comes with Pro on my next app since I want to support mobile. You can use Devart UniDac (commercial), or Zeos Database components (Open Source) for Database access with the community edition as long as your not making >5K annually from it. Both allow you to connect to many Databases. Firebird is a favorite of many Delphi developers, and has a client/server but also what is considered an embedded version. You just distribute a few files with your exe. This works well for small hobbyist apps. Firebird is actively supported. I used it in my last 2 small apps that will run from a USB drive. Another option is an older Database, "Advantage". SAP discontinued support a few years back at version 12, but the source is still available. It allowed you to use the local (embedded) version with up to 5 users before having to purchase the client/server version. It only works on Windows, but you just deploy 2 dll's minimum. The good thing with it is it has it's own data access components, just like the FD ones you just used. It has it's own GUI for creating and testing your databases. I just installed it on Delphi 12 and it still works just fine.
-
@JonRobertson That's great. I didn't see where he uploaded his database. Did you create it from his image?
-
@ColumboYour 2 hours ahead I'm in California You definitely need to figure out the SQL. If the tool you use doesn't let you test SQL statements, try DB Browser for SQLite (sqlitebrowser.org) Free/Donate. Now that you know it works with the table, you can try experimenting in the FDQuery editor. Right click FDQuery select Query Editor, enter your SQL and press Execute. The Delphi sample data retrieves the employees table with any of these 3 statements: SELECT * FROM employees SELECT * FROM 'employees' SELECT * FROM 'employees'; Can't help but think your table name being all uppercase is the problem. Try putting it in single quotes like above. I don't use SQLite so maybe someone else knows the problem for sure. Cool thing about Delphi is there is always "more than one way to skin a cat". In the Object Inspector for the Table set the Filter property to hyear = '1942', you only need the quotes around 1942 if it's a string, if the field is a number their are not needed, and the Filtered property to true.
-
Now use your original code to populate the memo, just use the Table
-
If the Active property is checked as true your good!!! You can try hooking up a DBGrid just to give yourself an extra boost. Drop a TDataSource on the form, set it's DataSet property to your table. Now a DBGrid and set it's DataSource property to the DataSource. If the Table is active you'll see the data
-
Some like to always use a Query, but if your just doing a SELECT *, a table component is way easier. You just set the connection and TableName properties, no need for a SQL Statement at all.
-
The tool in your previous post showing the table in the Database. Try the FDTable first
-
You can also try adding a FDTable instead of a FDQuery. Drop it on the form, make sure it's connection property is set to your connection, make sure the connection is set to connected. With the FDTable selected, In the object inspector look for the TableName property. There will be a dropdown listing all tables in the DataBase. Select your table, then set the FDTable Active property to true. If no errors you are connected
-
Problem in your SELECT statement. Did you enter it without any quotes ? Just SELECT * FROM DAT2 ? Can you get the same query to work in your Database tool?
-
Yahoo! So no problem connecting. Now on to the Query. Make sure the connection property of the FDQuery Component is set to your connection then right click and select Query editor, enter your SQL statement. See my previous image. Then click Execute. What happens?
-
What happens when you press "Test"?
-
BTW this is all in the designer you don't need to even run the program to get it working
-
Look at the image of the Object inspector, it is the first property. You connect to the database by setting the connection to "Connected True". Check or uncheck the box in the Object Inspector. Image's I posted are for the connection, look close, there is no SQL this is the connection, only properties having to do with the connection to your Database. Any SQL will be in the Query component. Right Click the FDQuery and select Query editor, see image. Enter your SQL statement. No quotes or semicolon SELECT * FROM DAT2. Press execute if good you will see your data below and the SQL for the component will be populated, if not your SQL Statement is the problem. Even though you can see the table in the Database it doesn't mean your SQL is valid. I once had a problem when migrating a MySQL server from Windows to a NAS drive. The default on the NAS did not allow capitols in table names and the whole program would not work because all my tables were a mix of lower and uppercase, SQL was now invalid. If the program you use to create/modify your SQLite database allows you to write queries do so. Make sure it works and then copy it into the FDQuery
-
When you look at the Object inspector there are 4 properties to set, see the image below. Line 4 DriverName has a dropdown list set it to SQLite Line 9 LoginPrompt if you do not have passwords set this to false and no login prompt will show Line 10 Name change to something better than default I like conMain or something more descriptive of your DB Expand the Params Property and the third line is the Database path. the ... will open a File Open dialog. Now set Line 1 Connected to true, if you get no errors and it stays checked your good. Even easier is Lajos suggestion, Right click FDConnection select Connection Editor, you can set all parameters except LoginPrompt there and it even has a Test button. This is the great thing about Delphi. The sample image attached I created in about 30 Seconds without a single line of code. I know you don't need the grid but it is a way to easily confirm that you have a valid DataSet. From your posts I suspect there are simple typo's and a mixture of trying to set properties in code and at design time. I think your SQL statement is the culprit, not the actual statement but how you are trying to set it in code, forget about that and just enter it in the FDQuery SQL property. If you want we can walk through setting up your Dataset like the sample and you can concentrate on your processing code.