1

我收到以下异常:

error processing SQL: object SQLTransaction

每次在手机间隙Android应用程序中,当我查询一个sqlite数据库时。

谢谢,这是完整的源代码

 <html>
 <head>
<script type="text/javascript">
   function validate()
   {

   var p=document.getElementById('searchid');

   var a=new Array();
   a[0]="PatientID";
   a[1]="FirstName";
   a[2]="DateOfBirth";

            for(var i=0;i<a.length;i++)
        {
          if(a[i]==p.getAttribute('placeholder'))
      {

        if(i==a.length-1)
                   {
           p.placeholder=a[0];
        break;
           }
          else
        {
        p.placeholder=a[i+1];
        break;
        }
        }


        }
}


     function validate1()
      {

   var db = window.openDatabase("Databases", "1.0", "PhoneGap Demo", 200000);
       db.transaction(queryDB, errorCB);
      }

     function queryDB(tx)
       {
  var                       placeholdervalue=document.getElementById('searchid').getAttribute('placeholder');
   var searchname=document.getElementById('searchid').value;
    alert(placeholdervalue+","+searchname);

          tx.executeSql("select * from Patient", [], querySuccess, errorCB);

     }
    function querySuccess(tx, results) 
    {
  alert('inside query success');
  var len = results.rows.length;

         if(len>0)
     {
     document.getElementById('tt').innerHTML="search found";
     }
     }

    function errorCB(err) {
        alert("Error processing SQL: "+err);
   }
  </script>
  </head>
       <body>
           <h3>Search</h3>
            <input type="button" value="&gt" onclick="validate()">
            <input type="text" name="search" id="searchid" placeholder="PatientID"/>
            <input type="button" value="search" onclick="validate1()">
           <span id="tt"></span>
     </body>
</html>

未调用函数 querySuccess(tx,results)(在此之前我得到异常)。请帮助

4

0 回答 0