auto increment id code for text field when connected to database.

You must Login before you can answer or comment on any questions.

Hi,

Please can anyone told me how to do the auto increment text filed code with the database connected in android app.

also how to connect android application with database which is server?

Many Thanks in advance.

— asked 7 months ago by Pratik Jayswal
4 Comments
  • // code for my auto increment

    tfrid.value= cnt;

    cnt = cnt + 1;

    cnt =tfrid.value;

    var tfrid = Ti.UI.createTextField({

    width: 200,
    
    
    height: 50,
    
    
    top: 40,
    
    
    right: 60,
    
    
    editable: false,
    

    font:{fontsize:12},

    text : '"+cnt+,
    
    
    softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, // Android only
    
    
    keyboardType : Ti.UI.KEYBOARD_NUMBER_PAD,
    
    
    returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
    
    
    borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
    });
    

    — commented 7 months ago by Pratik Jayswal

  • hello Pratik,

    so textData is coming from database right ?

    Then when you wants to increament in text..? I mean any button click or..?? and for what reasons you are using this textfield.?

    I mean can you describe more about your requirement that what exatlly you need ...?

    — commented 7 months ago by Sarafaraz Babi

  • Hi,

    I'm using it for database as an integer..

    on my 'submit' button click event data will be get inserted on the database and and after submitting textfield value should increase .automatically .

    — commented 7 months ago by Pratik Jayswal

  • Show 1 more comment

1 Answer

Hey Mate,

In that case when you click on Sumbit button write this code..

var val = tfadd.value;
    val = parseInt(val,'');
    val = val + 1;
    tfadd.value = val;
so it will increase one count in your textfield..

I think that is what you are asking for....

try it and let me know the result...

— answered 7 months ago by Sarafaraz Babi
answer permalink
8 Comments
  • Hi,

    Need one more help, can you please tell me that where to see the inserted data on install database?

    because whenever i insert any data its stored in the database but i'm not able to see that data in the table...

    and whenever i re-install the app the save data is displayed on the console log.. :(

    need help..

    — commented 7 months ago by Pratik Jayswal

  • so above code is working for you ? that is what you are looking for ????

    if you have installed that database at document directory than goto

    username > library > Application support > iphone simulator > iphone sdk > applications > your application..

    search in that..

    — commented 7 months ago by Sarafaraz Babi

  • Hi,

    Thanks for the information bu i'm working on android platform on windows os.

    — commented 7 months ago by Pratik Jayswal

  • Show 5 more comments

Your Answer

Think you can help? Login to answer this question!