macro with strsql to append data from calc to table in connected db

Hi everyone
I need to append data from connected calc to table in connected db.
Dont want to set focus to calc or this table.
Regards

Hello,

The question is not clear. Please provide more information. What type of database is used ( ie HSQLDB embedded, mySQL etc.)? Are you wanting data from calc to be added to something in a Base table or is it the reverse? Don’t understand what this means:

Dont want to set focus to calc or this table.

What is the role of strsql? What OS? What specific LO version is being used?

Overall the question needs clarification.

My guess is that strsql is a reference to code such as Is it possible to output cell values directly to base or MYSQL with macro. Please add links to code that you have looked at, and also add example code that you have tried so far. See guidelines for asking.

I don’t know what you expect from me. You act like a classic clerk, and you don’t help me solve the problem. What are you there for?
Write me what to do.

@lechu1,

It seems you do not understand that we are simply other users trying to help users like you. Unfortunately, quite often the information needed to help someone is missing and questions are asked - see comments above.

Now it appears you answered some of these questions and started it in a different post. As the comment there states, please move the information here (you can edit your question) then delete that other post.

Also in that post you mention:

…which adds data in the attached worksheet.

But there is no attached worksheet there. Without specific information on exactly what data and format and table and field name and possibly more there is little one can provide to you in the way of a macro. You have also not provided what example code you have already tried.

So:

you don’t help me solve the problem

is only because information is needed from you in order to provide an acceptable answer that works for your situation.

For those of you who wonder what the other question is, look there.

Hello,

Posting this not as a complete answer but a partial one. It will present an idea of the additional information needed to be provided by you. The code is on this post → Calc basic connects Base embedded Firebird

Some of the changes necessary - replace these lines with you Calc data:

oSheet = ThisComponent.Sheets.getByName("Sheet14")
inv_date = oSheet.getCellRangeByName("A10").value
TestDate = Format(inv_date, "YYYY-MM-DD")

and need to change registered DB name:

rem Change this for your registered Base name
    dbNAME = "REGISTERED_DB_NAME"

Also need to modify SQL to update your database:

rem compose SQL statement
rem insert date values into table (sample data & table)
    strSQL = "INSERT INTO TABLE3 (""NAME"",""Note"") VALUES ('Input 101', " & TestDate & ");"

and the variables in the SQL need to match up with the extracted Calc data noted above.

All this is information only you have and a final result may require even more.

There is no universal function for this type of function.

Dear @Ratslinger
thank you for the answer and once again I apologize for the ignorance.
The answer was very helpful.
Now I have a problem checking whether the table exists in the database or not.
Firebird 3.0.0 LO6.3 Linux Mint 18.3
greetings

@lechu1,

Please use answers only to answer the original question. Please delete & re-post as comment.