日期:2014-05-16 浏览次数:20422 次
<script type="text/javascript"> Ext.onReady(function(){ var cum = new Ext.grid.ColumnModel([ {header:'ID',dataIndex:'id'}, {header:'adValue',dataIndex:'adValue'}, {header:'adTime',dataIndex:'adTime'} ]); var store = new Ext.data.JsonStore({ proxy:new Ext.data.HttpProxy({url:'http://192.168.0.9/showAll.cgi'}), reader:new Ext.data.JsonReader({totalProperty:'totalProperty',root:'root'},[{name:'id'},{name:'adValue'},{name:'adTime'}]) }); //store.load(); alert(store.getCount());//这个地方显示为0 var cumgrid = new Ext.grid.GridPanel({ renderTo:'cumGrid', store:store, viewConfig:{ forceFit:true }, autoHeight:true, autoWidth:true, cm:cum, bbar:new Ext.PagingToolbar({ pageSize:10, autowidth:true, store:store, displayInfo:true, emptyMsg:'no record' }) }); }); </script>
#include "sqlite3.h" #include <stdio.h> int main(void) { printf("Content-Type:text/html;charset=gb2312\n\n"); // printf("<html>\n<body>\n"); sqlite3 *db; char *zErrMsg = 0; int rc; char *sql = "select * from tempture limit 20;"; char result[1024]="{totalProperty:20,root:["; char ** tableResult; int nRow,nColumn; int i,j,index; rc = sqlite3_open("envDB",&db); // printf("<table>\n<tr><td>ID</td><td>ADVALUE</td><td>ADTIME</td></tr>\n"); // printf("%d%d",rc,SQLITE_OK); if(rc) { fprintf(stdout,"Can't opendb:%s\n ",sqlite3_errmsg(db)); sqlite3_close(db); exit(1); } rc = sqlite3_get_table(db,sql,&tableResult,&nRow,&nColumn,&zErrMsg); if(SQLITE_OK == rc) { index = nColumn; for(i = 0;i < nRow;i++) { // printf("<tr>"); /* for(j =0;j < nColumn;j++) { printf("<td>%s</td>",tableResult[index]); index++; } */ strcat(result,"{id:"); strcat(result,tableResult[index]); strcat(result,","); index++; strcat(result,"adValue:"); strcat(result,tableResult[index]); strcat(result,","); index++; strcat(result,"adTime:"); strcat(result,tableResult[index]); if((i+1) == nRow){ strcat(result,"}"); }else{ strcat(result,"},"); } index++; // printf("</tr>\n"); } strcat(result,"]}"); } sqlite3_free_table(tableResult); sqlite3_close(db); printf("%s",result); // printf("</table>\n"); // printf("</body>\n"); // printf("</html>\n"); return 0; }