Android Question How to create app to display the database tables and search between them?

Yousef AlMashri

New Member
Hi guys,
I'm a new user of B4A tool.
First of all, I would like to thank everyone here for helping.
My question is, I want to create simple app to display the SQL Tables with search button.
So, I was created different 4 tables using (DB Browser for SQLite) and I saved them as file.db.

Note: I don't want to add anybutton for (add, edit, delete). The app wanted to display the tables only.

Now I want to start to create B4A project to display the tables and search between them.
The problem here is, I don't know how I should start.

Can anyone help me please.
 

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Hi guys,
I'm a new user of B4A tool.
First of all, I would like to thank everyone here for helping.
My question is, I want to create simple app to display the SQL Tables with search button.
So, I was created different 4 tables using (DB Browser for SQLite) and I saved them as file.db.

Note: I don't want to add anybutton for (add, edit, delete). The app wanted to display the tables only.

Now I want to start to create B4A project to display the tables and search between them.
The problem here is, I don't know how I should start.

Can anyone help me please.

When you say display the tables only, I take it you want to display the tables plus their fields.
So, you want some kind of DB Browser.
In that case you could make 2 listviews, one on the left for the tables and one on the right for
the fields of the selected tables. You could then populate both listviews from 2 views, created
like this:

CREATE VIEW SysObjects as select type as ObjectType, name as ObjectName from sqlite_master where type in('table', 'view', 'index')

CREATE VIEW SysColumns as select ObjectType, ObjectName, cid as ColumnID, name as ColumnName, type as Affinity, IsNotNull, dflt_value
as DefaultValue, pk as IsPrimaryKey from SysObjects join pragma_table_info(ObjectName)

The result of:

select * from SysColumns

Will give you all need to populate both listviews.

This I think is a good starting point.


RBS
 
Upvote 0

Yousef AlMashri

New Member
When you say display the tables only, I take it you want to display the tables plus their fields.
So, you want some kind of DB Browser.
In that case you could make 2 listviews, one on the left for the tables and one on the right for
the fields of the selected tables. You could then populate both listviews from 2 views, created
like this:

CREATE VIEW SysObjects as select type as ObjectType, name as ObjectName from sqlite_master where type in('table', 'view', 'index')

CREATE VIEW SysColumns as select ObjectType, ObjectName, cid as ColumnID, name as ColumnName, type as Affinity, IsNotNull, dflt_value
as DefaultValue, pk as IsPrimaryKey from SysObjects join pragma_table_info(ObjectName)

The result of:

select * from SysColumns

Will give you all need to populate both listviews.

This I think is a good starting point.


RBS
Thanks for your reply, I will follow your idea
 
Upvote 0
Top