Android Question Number of fields

Discussion in 'Android Questions' started by Enthousiastic, Jul 1, 2015.

  1. Enthousiastic

    Enthousiastic Active Member Licensed User

    Hello , is there any way to get or calculate the number of the fields of a loaded table or from a sql ?
    This will be useful because I am thinking to make a module based on Tableview , when input the sqlite database and choose the table , to populate the tableview grid. Something like Sqlview example , with the difference instead of webview to use tableview.

    Many
    Thanks Enthousiastic
     
  2. DonManfred

    DonManfred Expert Licensed User

    Code:
    log(Cursor1.ColumnCount)
     
    mangojack, lemonisdead and walterf25 like this.
  3. Enthousiastic

    Enthousiastic Active Member Licensed User

    Hello again , first thank you for your answer . As i said taking as example the SQLiteViewer , i've tried to populate the grid using Tableview module instead of WebView.
    So i've tried ( see the SQLiteViewer.zip ) , but in debugger i have an error in line 51 in TableActivity . What am I doing wrong ?
    If i want to populate the Table using " SELECT field1,field2 ..... " or " SELECT field1 as [] , field2 as [] .... " , what shall i write , thinking that i a m loading the table and i don't know the fields from the beginning.

    THANKS AGAIN IN ADVANCED !
     

    Attached Files:

  4. sorex

    sorex Expert Licensed User

    if you don't know the field names then you can use select * but then the order might be random too.
     
  5. Enthousiastic

    Enthousiastic Active Member Licensed User

    Ok , but in debugger i have an error in line 51 in TableActivity , and the table is not populated. What am I doing wrong ?
     
  6. sorex

    sorex Expert Licensed User

    can you send me a link to that sqlite file via PM? it's missing from the project.
     
  7. Enthousiastic

    Enthousiastic Active Member Licensed User

    The file for example is rbdemo.db for testing . Imagine you have and other databases in your tablet or cell phone and try to open with "open external file manager" or
    "Open internal file manager" buttons or menuitem from main program activity.
     

    Attached Files:

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice