帮别人做的演示系统,只具有基本的增删查改功能。
核心是android端和后台通过http传输数据
后台是asp.net,数据库是ms sql 2008
android端
private void getData() { RequestParams params = new RequestParams(); params.put("action", "getlista"); params.put("chepai", etSearch.getText().toString()); netClient.post(Constants.che_URL, params, new BaseJsonRes() { @Override public void onMySuccess(String data) { listdata.clear(); if (!TextUtils.isEmpty(data)) { List<CheModel> models = (JSON.parseArray(data, CheModel.class)); for (int i = 0; i < models.size(); i++) { Map<String, String> che = new HashMap<String, String>(); che.put("name", models.get(i).getChepai()); che.put("info", models.get(i).getXinghao()); che.put("id", models.get(i).getId()); listdata.add(che); } } adpter.notifyDataSetChanged(); } @Override public void onMyFailure() { Utils.showShortToast(getActivity(), "网络错误"); } }); }
后台(asp.net)
private void GetDataLista(HttpContext context) { int _pageindex = 1; int _pagesize = 20; if (pageindex > 0) _pageindex = pageindex; if (pagesize > 0) _pagesize = pagesize; string where = ""; if(!string.IsNullOrEmpty(weizhi)) { where = "weizhi like '%"+weizhi+"%'"; } string json = cheweiBll.Current.GetJSONdataForAndroid(_pageindex, _pagesize, "id asc", where); context.Response.Write(Common.JSONhelper.CreateResponseJson("1", "", json.Replace(""griddata":}", ""griddata":[]}").ToLower())); }
下载地址
http://download.csdn.net/detail/shmiluwabi666/9546471