Forum > General

component list to database

(1/1)

secretk:
Hi All,

Im very new to Lazarus pascal and need a bit of help

I found this piece of code:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button5Click(Sender: TObject);  var  i: Integer;  list: string;begin  for i := 0 to ComponentCount-1 do    list:=list+#10#13+Components[i].Tag.ToString;   ShowMessage('We can also list all the components in the form without knowing their names:'+list);end;
It works fine but can someone help me how to put this (List) information in a MySql database table?
(I use Zeos Access for database connection)

wp:
To be honest I do not understand your code. Why do you need the "Tag" of the components?

In the attachment you can find a quick and dirty demo how to iterate through the components on a form and to write their names to a listbox or to a sqlite3 database (sorry I don't have access to MySQL, but the code should be very similar).

secretk:
Thxs wp for the fast reply

The reason i need the "Tag" is to be able to setup a users roles and rights in the database based of something specific to the component.

based on the tag i will try to add specific CRUD settings to the database
based on those settings trying to give specific access to the components within the form.

If someone has a better idea i'm open for it.

In your example your using "Name" but that won't work for me because i need a unique identifier for a group of components.

Example would be; If components DBgrid1 and DBgrid2 has tag "1" then they have CRUD access and if DBgrid3 has tag "2" then it had CRU access.

wp:
Your question was about how to save a list of the components on a form in a database. I did not care about the details of your application which I don't know. I only selected the component name, but if you understand the idea behind the demo you will be able to extend it to other properties such as the "Tag".

Navigation

[0] Message Index

Go to full version