This article is a mirror article of machine translation, please click here to jump to the original article.

View: 469351|Reply: 257

[E4A] E4A Display sqlite database queries as tables [source code]

  [Copy link]
Posted on 6/4/2017 8:49:09 AM | | | |
The picture below is the e4a operation sqlite database in the official example, with basic additions, deletions, modifications, and checks.

But the display of the queryed data line by line feels ugly, can it be displayed in a table?



The following is the data I queried from the sqlite database, which is shown in a table, as shown in the figure below:



Since there is too much code displayed in the table, the source code is placed at the bottom for everyone


Official example code:



The table displays the data source code:

Tourists, if you want to see the hidden content of this post, pleaseReply



Score

Number of participants1MB+1 contribute+1 Collapse reason
azgun + 1 + 1 Violation topics

See all ratings





Previous:E4A double-click the return button to exit the program [Source Code]
Next:php returns a json string
Posted on 1/4/2018 9:16:38 PM |

The variable database table name is Text
Event Main Window. Created()
        database table name = "mytable"
End Event

Event button 4. Clicked ()
        If the file exists (take the memory card path() > "/mydata.db") = false
                Create a database (take the card path () > "/mydata.db")
                A pop-up prompt ("Create database successful!") )
        End If
        Open the database (take the card path() > "/mydata.db") '!! The database must be opened before performing any database operations
        A pop-up prompt ("Open database successful!") )
End Event

Event button 1. Clicked ()
        If the data table exists (database table name) = false
                'CREATE TABLE ' & Database table name & "(id text,value text)") 'Create a data table with two columns, the first column is id and the second column is value
                Create a data table (database table name, "id text, value text")
                If you want to create a self-incrementing id field, you can write Create Data Table (database table name, "id integer PRIMARY KEY, value text")
                A pop-up prompt ("Create datasheet successful!") )
        Otherwise        
                A pop-up prompt ("The datasheet already exists!") )
        End If        
End Event

Event button 2. Clicked ()
' Database Execution ("INSERT INTO " & Database Table Name & "VALUES ('1','zhangshang@163.com')") 'Insert records
' Database Execution ("INSERT INTO " & Database Table Name & " VALUES ('2','1234567@qq.com')")
' Database Execution ("INSERT INTO" & Database Table Name & "VALUES ('3','Lisi@126.com')")
' Database Execution ("INSERT INTO " & Database Table Name & " VALUES ('4','Wangwu@163.com')")
        Insert record (database table name, "'1','zhangshang@163.com'")
        Insert record (database table name, "'2','1234567@qq.com'")
        Insert record (database table name, "'3','Lisi@126.com'")
        Insert record (database table name, "'4','Wangwu@163.com'")
        'If id is a self-incrementing field, it should be written like this Insert record (database table name, 'null,'Wangwu@163.com'")
        To insert the contents of the edit box, you can write like this: Insert record (database table name, "'" & edit box 1.content & "','" & edit box 2.content & "'")
    A pop-up prompt ("Insertion successful!") )
End Event

Event button 3. Clicked ()
        'Edit box 1.Content = database query("SELECT * FROM" & database table name & " WHERE id='1'","-","\n") 'Query id='1' for the record, the children of each record are separated by -, and the records are separated by line breaks
        'Edit box 1.Content = conditional query (database table name, "id='1'", "-", "\n")
        If delete the beginning and end of the blank (edit box 2.content) = "" then
                Pop-up prompt ("Please enter query criteria")
                Exit
        End If
        Edit box 1.Content = conditional query(database table name,"id='" > delete the first and last spaces (edit box 2.content) > "'","-","\n")
        A pop-up prompt ("Query successful!") )
End Event

Event button 6. Clicked ()
        'Database execution ('UPDATE' & database table name > 'SET value='This is the modified value' WHERE id='1'") 'Modify id='1' for that record
        Modify the record (database table name, "value='This is the modified value'", "id='1'")
        A pop-up prompt ("Modified successfully!") )        
End Event

Event button 5. Clicked ()
        'DELETE FROM' ("DELETE FROM" & database table name & " WHERE id='1'") 'delete the record id='1'
    Delete record (database table name, "id='1'")
        A pop-up prompt ("Deleted successful!") )
End Event

Event button 7. Clicked ()
        'DATABASE EXECUTION' ("DROP TABLE" > database table name) deletes the entire database table
        Deleting a Data Table (Database Table Name)
        A pop-up prompt ("Delete database table successful!") )
End Event

Event button 8. Clicked ()
        Pop-up prompt ("Total number of records:" > Number of records (database table name) > "Items")
End Event

Event button 9. Clicked ()
        'Edit box 1.Content = database query("SELECT * FROM" > database table name > "WHERE value LIKE '%163.com'","-","\n") 'Query all records with values ending in '163.com'
        Edit box 1. Content = conditional query (database table name, "value LIKE '%163.com'", "-", "\n")
        A pop-up prompt ("Query successful!") )
End Event

Event button 10. Clicked ()
        'Edit box 1.Content = database query("SELECT * FROM" > database table name & "LIMIT 0,3","-","\n") 'Query 3 records starting from 0 (1).
        Edit box 1. Content = Scope query (database table name, 0, 3, "-", "\n")
        A pop-up prompt ("Query successful!") )
End Event

Event button 11. Clicked ()
        Close the database() '!! Close the database at the end of the program
        End Procedure ()
End Event
Posted on 10/30/2018 5:25:40 PM |

The variable database table name is Text
Event Main Window. Created()
database table name = "mytable"
End Event

Event button 4. Clicked ()
If the file exists (take the memory card path() > "/mydata.db") = false
Create a database (take the card path () > "/mydata.db")
A pop-up prompt ("Create database successful!") )
End If
Open the database (take the card path() > "/mydata.db") '!! The database must be opened before performing any database operations
A pop-up prompt ("Open database successful!") )
End Event

Event button 1. Clicked ()
If the data table exists (database table name) = false
'CREATE TABLE ' & Database table name & "(id text,value text)") 'Create a data table with two columns, the first column is id and the second column is value
Create a data table (database table name, "id text, value text")
If you want to create a self-incrementing id field, you can write Create Data Table (database table name, "id integer PRIMARY KEY, value text")
A pop-up prompt ("Create datasheet successful!") )
Otherwise
A pop-up prompt ("The datasheet already exists!") )
End If
End Event

Event button 2. Clicked ()
' Database Execution ("INSERT INTO " & Database Table Name & "VALUES ('1','zhangshang@163.com')") 'Insert records
' Database Execution ("INSERT INTO " & Database Table Name & " VALUES ('2','1234567@qq.com')")
' Database Execution ("INSERT INTO" & Database Table Name & "VALUES ('3','Lisi@126.com')")
' Database Execution ("INSERT INTO " & Database Table Name & " VALUES ('4','Wangwu@163.com')")
Insert record (database table name, "'1','zhangshang@163.com'")
Insert record (database table name, "'2','1234567@qq.com'")
Insert record (database table name, "'3','Lisi@126.com'")
Insert record (database table name, "'4','Wangwu@163.com'")
'If id is a self-incrementing field, it should be written like this Insert record (database table name, 'null,'Wangwu@163.com'")
To insert the contents of the edit box, you can write like this: Insert record (database table name, "'" & edit box 1.content & "','" & edit box 2.content & "'")
A pop-up prompt ("Insertion successful!") )
End Event

Event button 3. Clicked ()
'Edit box 1.Content = database query("SELECT * FROM" & database table name & " WHERE id='1'","-","\n") 'Query id='1' for the record, the children of each record are separated by -, and the records are separated by line breaks
'Edit box 1.Content = conditional query (database table name, "id='1'", "-", "\n")
If delete the beginning and end of the blank (edit box 2.content) = "" then
Pop-up prompt ("Please enter query criteria")
Exit
End If
Edit box 1.Content = conditional query(database table name,"id='" > delete the first and last spaces (edit box 2.content) > "'","-","\n")
A pop-up prompt ("Query successful!") )
End Event

Event button 6. Clicked ()
'Database execution ('UPDATE' & database table name > 'SET value='This is the modified value' WHERE id='1'") 'Modify id='1' for that record
Modify the record (database table name, "value='This is the modified value'", "id='1'")
A pop-up prompt ("Modified successfully!") )
End Event

Event button 5. Clicked ()
'DELETE FROM' ("DELETE FROM" & database table name & " WHERE id='1'") 'delete the record id='1'
Delete record (database table name, "id='1'")
A pop-up prompt ("Deleted successful!") )
End Event

Event button 7. Clicked ()
'DATABASE EXECUTION' ("DROP TABLE" > database table name) deletes the entire database table
Deleting a Data Table (Database Table Name)
A pop-up prompt ("Delete database table successful!") )
End Event

Event button 8. Clicked ()
Pop-up prompt ("Total number of records:" > Number of records (database table name) > "Items")
End Event

Event button 9. Clicked ()
'Edit box 1.Content = database query("SELECT * FROM" > database table name > "WHERE value LIKE '%163.com'","-","\n") 'Query all records with values ending in '163.com'
Edit box 1. Content = conditional query (database table name, "value LIKE '%163.com'", "-", "\n")
A pop-up prompt ("Query successful!") )
End Event

Event button 10. Clicked ()
'Edit box 1.Content = database query("SELECT * FROM" > database table name & "LIMIT 0,3","-","\n") 'Query 3 records starting from 0 (1).
Edit box 1. Content = Scope query (database table name, 0, 3, "-", "\n")
A pop-up prompt ("Query successful!") )
End Event

Event button 11. Clicked ()
Close the database() '!! Close the database at the end of the program
End Procedure ()
End Event
Posted on 10/4/2020 11:54:03 AM |

Event button 2. Clicked ()
' Database Execution ("INSERT INTO " & Database Table Name & "VALUES ('1','zhangshang@163.com')") 'Insert records
' Database Execution ("INSERT INTO " & Database Table Name & " VALUES ('2','1234567@qq.com')")
' Database Execution ("INSERT INTO" & Database Table Name & "VALUES ('3','Lisi@126.com')")
' Database Execution ("INSERT INTO " & Database Table Name & " VALUES ('4','Wangwu@163.com')")
        Insert record (database table name, "'1','zhangshang@163.com'")
        Insert record (database table name, "'2','1234567@qq.com'")
        Insert record (database table name, "'3','Lisi@126.com'")
        Insert record (database table name, "'4','Wangwu@163.com'")
        'If id is a self-incrementing field, it should be written like this Insert record (database table name, 'null,'Wangwu@163.com'")
        To insert the contents of the edit box, you can write like this: Insert record (database table name, "'" & edit box 1.content & "','" & edit box 2.content & "'")
    A pop-up prompt ("Insertion successful!") )
Posted on 6/7/2017 5:35:36 PM |
11111111111111111

Score

Number of participants1MB-1 contribute-1 Collapse reason
QWERTYU -1 -1 Please do not pour water, it is the duty of every member to improve the reply information.

See all ratings

Posted on 6/16/2017 2:40:30 PM |
Thanks for sharing, I like it the most.
Posted on 6/16/2017 2:57:50 PM |
It seems that it is impossible to download today,
Posted on 9/5/2017 12:45:19 PM |
Thanks for sharing
Posted on 9/11/2017 9:20:38 PM |
Awesome support
Posted on 9/16/2017 10:21:48 PM |
Mark Tag
Posted on 9/18/2017 8:49:41 AM |
DKFRKFRTHREDER4

Score

Number of participants1MB-1 contribute-1 Collapse reason
QWERTYU -1 -1 Please do not pour water, it is the duty of every member to improve the reply information.

See all ratings

Posted on 10/27/2017 8:19:00 AM |
Thanks for sharing, download and take a look
Posted on 11/8/2017 2:00:43 PM |
Prompt:Authors are banned or removed content is automatically blocked
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com