How do i import a data from a table as a variable in lazarus? lazarus / 16-Databases ---------------------------------------------------------------------- workinghard · 2012-03-27 03:01 Hi everyone, I'm using lazarus 0.9.30 and FPC 2.4.2. And in this program, i must import the data from a table and use it as a variable, so that i can run the calculations in the program itself, (when i do the calculation on mysql, it returns an error very often) then upload the data to the database so, in order to do that, what should i do? ---------------------------------------------------------------------- Lacak2 · 2012-03-27 06:24 BTW what error returns MySQL ? Doing calculation on server side seems to me as better that read data to client do calculations and write data back ---------------------------------------------------------------------- workinghard · 2012-03-27 07:49 I was getting an error #1242 It's fixed now though... thanks Lacak2 for helping ---------------------------------------------------------------------- Leledumbo · 2012-03-28 03:25 Here you can see the description of the error. Probably your query was wrong. ---------------------------------------------------------------------- workinghard · 2012-03-28 09:49 But still, is it possible to do this? Cause i really need to get this program up and running as soon as possible, since i always get a Parameter error when querying I hoPed that by doing it this way, even though the code will be more comPlex, it will be able to be done quicker ---------------------------------------------------------------------- BigChimp · 2012-03-28 11:31 Going to be a bit blunt here, but some work on your part now in understanding how things work will pay off. I know it's hard in the beginning. Working around your programming errors by programming more inefficient code is going to work... until you hit the next error... Working around other people's errors on the other hand.. With this behind us: Quotemust import the data from a table and use it as a variable, so that i can run the calculations in the program itself What have you tried yourself? What approach do you think would work? What documentation have you read and what did not make sense to you/work? From a basic perspective, I'd extract the data from the databse, perform the calculation and store the result (= what you said in your question). If you need to loop through a table/view when calculating data, you should do that. What have you tried yourself? What error messages do you get? It's very difficult to answer these kinds of questions without giving ready made snippets of code that possibly might work for you (or not at all) and probably won't help in your understanding of what is going on... In addition, there's tons of wiki pages, Delphi tutorials, even a Lazarus book (which won't tell you this particular issue though), a Lazarus online free book by motaz (search the forum). Regards, BigChimp ---------------------------------------------------------------------- Leledumbo · 2012-03-28 12:43 QuoteBut still, is it possible to do this?Why not? It's very common in database centric apps, and there are a lot of them written in Lazarus/FPC.