internal SqlSentence SelectByName(string sqlName, int status) { SqlSentence snt = new SqlSentence(); string sql = "SELECT * FROM SqlSentence WHERE Status = "+ status +" AND SqlName='" + sqlName + "'"; SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql); DataSet ds = SQLiteHelper.ExecuteDataSet(cmd); DataTable dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { DataModelHandler<SqlSentence> dmh = new DataModelHandler<SqlSentence>(); snt = dmh.FillModel(dt.Rows[0]); } return snt; }
internal List<User> Select(int status) { List<User> users = new List<User>(); string sql = "SELECT * FROM User WHERE Status = " + status; SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql); DataSet ds = SQLiteHelper.ExecuteDataSet(cmd); DataTable dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { DataModelHandler<User> dmh = new DataModelHandler<User>(); users = dmh.FillModel(dt); } return users; }
internal DbConn SelectFirst(int status) { DbConn conn = new DbConn(); string sql = "SELECT TOP 1 * FROM DbConn WHERE Status = " + status + ""; SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql); DataSet ds = SQLiteHelper.ExecuteDataSet(cmd); DataTable dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { DataModelHandler<DbConn> dmh = new DataModelHandler<DbConn>(); conn = dmh.FillModel(dt.Rows[0]); } return conn; }
internal List <DbConn> Select(int status) { List <DbConn> conns = new List <DbConn>(); string sql = "SELECT * FROM DbConn WHERE Status = " + status; SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql); DataSet ds = SQLiteHelper.ExecuteDataSet(cmd); DataTable dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { DataModelHandler <DbConn> dmh = new DataModelHandler <DbConn>(); conns = dmh.FillModel(dt); } return(conns); }
internal DbConn SelectFirst(int status) { DbConn conn = new DbConn(); string sql = "SELECT TOP 1 * FROM DbConn WHERE Status = " + status + ""; SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql); DataSet ds = SQLiteHelper.ExecuteDataSet(cmd); DataTable dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { DataModelHandler <DbConn> dmh = new DataModelHandler <DbConn>(); conn = dmh.FillModel(dt.Rows[0]); } return(conn); }
internal SqlSentence SelectByName(string sqlName, int status) { SqlSentence snt = new SqlSentence(); string sql = "SELECT * FROM SqlSentence WHERE Status = " + status + " AND SqlName='" + sqlName + "'"; SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql); DataSet ds = SQLiteHelper.ExecuteDataSet(cmd); DataTable dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { DataModelHandler <SqlSentence> dmh = new DataModelHandler <SqlSentence>(); snt = dmh.FillModel(dt.Rows[0]); } return(snt); }
internal User SelectByName(string userName, int status) { User user = new User(); string sql = "SELECT * FROM User WHERE Status = "+ status +" AND UserName = '******'"; SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql); DataSet ds = SQLiteHelper.ExecuteDataSet(cmd); DataTable dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { DataModelHandler<User> dmh = new DataModelHandler<User>(); user = dmh.FillModel(dt.Rows[0]); } else user = null; return user; }
internal User SelectByName(string userName, int status) { User user = new User(); string sql = "SELECT * FROM User WHERE Status = " + status + " AND UserName = '******'"; SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql); DataSet ds = SQLiteHelper.ExecuteDataSet(cmd); DataTable dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { DataModelHandler <User> dmh = new DataModelHandler <User>(); user = dmh.FillModel(dt.Rows[0]); } else { user = null; } return(user); }