public ArrayList query_pid(int qun_type, out string out_log) { out_log = ""; try { string sql = "select * from pid where qun_type=" + qun_type + " limit 2000 "; ArrayList list = new ArrayList(); SQLiteDBHelper db = new SQLiteDBHelper(this.app_path + @"\config\" + this.db_name); using (SQLiteDataReader reader = db.ExecuteReader(sql, null)) { while (reader.Read()) { //qun_name,qun_pid,qun_type,create_date,weiba PidBean pidBean = new PidBean(); pidBean.pid_id = reader.GetInt32(0); pidBean.qun_name = reader.GetString(1); pidBean.qun_pid = reader.GetString(2); pidBean.qun_type = reader.GetInt32(3); pidBean.weiba = reader.GetString(4); list.Add(pidBean); } } out_log = ""; return(list); } catch (Exception ex) { out_log = ex.ToString(); } return(new ArrayList()); }
public bool insert_pid(PidBean pidBean, out string out_log) { try { DateTime now = DateTime.Now; string sql = "INSERT INTO pid(qun_name,qun_pid,qun_type,create_date,weiba) values(@qun_name,@qun_pid,@qun_type,@create_date,@weiba)"; SQLiteDBHelper db = new SQLiteDBHelper(this.app_path + @"\config\" + this.db_name); SQLiteParameter[] parameters = new SQLiteParameter[] { new SQLiteParameter("@qun_name", pidBean.qun_name), new SQLiteParameter("@qun_pid", pidBean.qun_pid), new SQLiteParameter("@qun_type", pidBean.qun_type), new SQLiteParameter("@create_date", now), new SQLiteParameter("@weiba", pidBean.weiba) //, //new SQLiteParameter("@status",weiboBean.status) }; db.ExecuteNonQuery(sql, parameters); out_log = ""; return(true); } catch (Exception exception) { out_log = exception.ToString(); return(false); } }