Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8560741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:20:47+00:00 2026-06-11T16:20:47+00:00

im actually dotnet developer now im starting to develop mobile application using eclipse android

  • 0

im actually dotnet developer now im starting to develop mobile application using eclipse android and phonegap i have studied these in docs.phonegap.com i find no difficulty in examples ie camera device and accelerometer. I have successfully connected to database now my question is how can i applay autoincrement in create table and retreive ( max id +1) from database the given code is not working

my code is

Javascript code#

     function onDeviceReady() {
            var db = window.openDatabase('dbNexTrainer','1.0', 'NexTrainer',2 * 1024 * 1024);
            db.transaction(populateDB, errorCB, successCB);
        }
function populateDB(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS tbl_Excercise  (ExId INTEGER PRIMARY KEY AUTOINCREMENT ,ExName ,ExDescription ,ExPreCondition ,ExImage ,IsActive INTEGER,AddDate DATE)');
tx.executeSql('Delete from tbl_Excercise');
tx.executeSql('INSERT INTO tbl_Excercise  VALUES (1,"Excercise 1","Description 1","Pre Condition 1","image/image1.png",1,"12/09/2012 01:00:00")');
tx.executeSql('INSERT INTO tbl_Excercise  VALUES (2,"Excercise 2","Description 2","Pre Condition 2","image/image2.jpg",1,"12/09/2012 01:00:00")');
tx.executeSql('INSERT INTO tbl_Excercise  VALUES (3,"Excercise 3","Description 3","Pre Condition 3","image/image3.jpg",1,"12/09/2012 01:00:00")');
tx.executeSql('INSERT INTO tbl_Excercise  VALUES (4,"Excercise 4","Description 4","Pre Condition 4","image/image4.jpg",1,"12/09/2012 01:00:00")');

second problem how to retrieve max id

Javascript Code

   function NewExcercise(){
     var db = window.openDatabase('dbNexTrainer','1.0', 'NexTrainer',2 * 1024 * 1024);
          db.transaction(GetNewExId, errorCB);    
    }
var  GetNewExId=function(tx) 
       {
           var db = window.openDatabase('dbNexTrainer','1.0', 'NexTrainer',2 * 1024 * 1024);
          var sql = "SELECT MAX(ExId)+1 as ExId FROM tbl_Excercise";
           tx.executeSql(sql, [], ReturnNewId, errorCB); 
           return  window.localStorage.getItem('NewExId') 
      }

      var  ReturnNewId  = function(transaction, results) {
   try{       
         var row = results.rows.item(i);          
         window.localStorage.setItem('NewExId', row['ExId']);            
    }
    catch(e){
    alert(e);
    }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:20:48+00:00Added an answer on June 11, 2026 at 4:20 pm

    You have error in CREATE TABLE syntax, you need to define the data types for all the table fields,

    try this statement,

    tx.executeSql('CREATE TABLE IF NOT EXISTS tbl_Excercise  (ExId INTEGER PRIMARY KEY AUTOINCREMENT ,ExName TEXT ,ExDescription TEXT ,ExPreCondition TEXT ,ExImage BLOB ,IsActive INTEGER,AddDate DATE)');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually, I am facing a problem in Android. I am creating an application that
actually, i'm developing a web template using ASP.NET and C#. i have a listview
Actually I am working on the Couchdb .Till now i have used the Local
Actually I am using 2 Tabs.Both of the tab is having different activity.Now when
Actually i am developing a Map browser app in Android. I have a .dat
Actually, I'm using this way. Do you have a better way? private bool AcceptJson(HttpRequest
Actually I'm trying to convert hex to bin. a=hex2dec('ab32'); a=dec2bin(a); %now I have a
Actually I'm developing an iOS application for specific mobile operator, The app will be
Actually I am developing one application in that when application run first time it
Actually I am new to jquery as well as web designing Now I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.