zoukankan      html  css  js  c++  java
  • 数据库中信息存放到 实体类中

    把数据库中信息存放到 实体类中,实体类设置值

    	Tb_pay tb_pay = payDAO.find(userid,Integer.parseInt(strno));
    			txtMoney.setText(String.valueOf(tb_pay.getMoney()));// 显示金额
    			txtTime.setText(tb_pay.getTime());// 显示时间
    			spType.setSelection(tb_pay.getType()-1);// 显示类别
    			txtHA.setText(tb_pay.getAddress());// 显示地点
    			txtMark.setText(tb_pay.getMark());// 显示备注
    

    把从数据库中查出来的数据 放到一个实体类里面,

    /**
    	 * 查找支出信息
    	 * 
    	 * @param id,no
    	 * @return
    	 */
    	public Tb_pay find(int id,int no) {
    		db = helper.getWritableDatabase();// 初始化SQLiteDatabase对象
    		Cursor cursor = db
    				.rawQuery(
    						"select _id,no,money,time,type,address,mark from tb_pay where _id = ? and no=?",
    						new String[] { String.valueOf(id),String.valueOf(no) });// 根据编号查找支出信息,并存储到Cursor类中
    		if (cursor.moveToNext())// 遍历查找到的支出信息
    		{
    			// 将遍历到的支出信息存储到Tb_outaccount类中
    			return new Tb_pay(
    					cursor.getInt(cursor.getColumnIndex("_id")),
    					cursor.getInt(cursor.getColumnIndex("no")),
    					cursor.getDouble(cursor.getColumnIndex("money")),
    					cursor.getString(cursor.getColumnIndex("time")),
    					cursor.getInt(cursor.getColumnIndex("type")),
    					cursor.getString(cursor.getColumnIndex("address")),
    					cursor.getString(cursor.getColumnIndex("mark")));
    		}
    		return null;// 如果没有信息,则返回null
    	}
    
  • 相关阅读:
    微信商城中使用微信支付接口获取用户地址
    微信支付开发流程
    沉默多年,重新开博
    Extjs 表单验证后,几种错误信息展示方式
    自己对Extjs的Xtemplate的忽略
    js execCommand
    支付宝支付
    C# 将短时间格式变长正常时间格式
    SortedDictionary
    sql操作
  • 原文地址:https://www.cnblogs.com/childhooding/p/4504914.html
Copyright © 2011-2022 走看看