Good day! I'm a newbie in livecode. I'm using MySQL as my database.
I figured out how to connect LC to MySQL but i need help to display my records from my database to the DATA GRID.
I don't know how to display records in the datagrid.
for example i have DbName as my database name, Users as my Table name. I have 2 fields: ID and NAME.
I have myGrid as my DATA GRID name with two columns: ID and NAME.
I need to display all the record in my database to my myGrid and It will be nice if I can UPDATE and DELETE some records from the DATAGRID.
I try to learn programming using Livecode.
Thanks and Good day!
MySQL to Data Grid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: MySQL to Data Grid
Hi iambath,
1. welcome to the forum!
2. I suppose the data from your db comes in "standard" TAB and CR delimited text?
then you can simply (supposed you have a datagrid of type TABLE!):
"the dgtext of grp datagridXYZ" is always in TAB and CR delimited text format and
can be easily used with TABLE datagrids like here.
"the dgdata of grp datagridXYZ" in an ARRAY in format:
tArray[1]["name of column1"]
tArray[1]["name of column2"]
...
tArray[N]["name of column1"]
tArray[N]["name of column2"]
But both can be used to get and set data in a TABLE and FORM datagrid.
Check these pages and download the datagrid documantation as PDF from that page:
http://lessons.livecode.com/m/datagrid
Hint: the download link is hidden in tiny fontsize on the left side under "Topics".
And don't hesitate to come back with more questions!
Unfortunately datagrids are the most complex objects EVER in Livecode!
Best
Klaus
1. welcome to the forum!
2. I suppose the data from your db comes in "standard" TAB and CR delimited text?
then you can simply (supposed you have a datagrid of type TABLE!):
Code: Select all
...
set the dgtext of grp "your datagrid here..." to variable_filled_with_data_from_sql_query
## You get the picture!
...
can be easily used with TABLE datagrids like here.
"the dgdata of grp datagridXYZ" in an ARRAY in format:
tArray[1]["name of column1"]
tArray[1]["name of column2"]
...
tArray[N]["name of column1"]
tArray[N]["name of column2"]
But both can be used to get and set data in a TABLE and FORM datagrid.
Check these pages and download the datagrid documantation as PDF from that page:
http://lessons.livecode.com/m/datagrid
Hint: the download link is hidden in tiny fontsize on the left side under "Topics".
And don't hesitate to come back with more questions!
Unfortunately datagrids are the most complex objects EVER in Livecode!
Best
Klaus
Re: MySQL to Data Grid
Thanks for the answer Klaus
I can display my records from the database but i am using a fields, the problem i don't know how to update or delete it from the field.
That's why I decided to used DATAGRID unfortunately like you said its complex .
I don't have example source code to study it(MySQL-LIVECODE using DATAGRID table). Mostly they are using SQLite.
It will be a big help if I can study sample stack about it. Even it has only 1 column.
Thank you and Good day!
I can display my records from the database but i am using a fields, the problem i don't know how to update or delete it from the field.
That's why I decided to used DATAGRID unfortunately like you said its complex .
I don't have example source code to study it(MySQL-LIVECODE using DATAGRID table). Mostly they are using SQLite.
It will be a big help if I can study sample stack about it. Even it has only 1 column.
Thank you and Good day!
Re: MySQL to Data Grid
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w