예제 #1
0
        public List <MessageBoard> GetMessageBoard(int index, int size, ref int pageCount, ref int recordCount)
        {
            var key    = "ID";
            var fields = "[Name],[Homepage],[QQ],[Phone],[Message],[CreateTime]";
            var tables = "MessageBoard";

            var where = "";
            var orderBy = "ID DESC";

            var dataTable = new AccessDbUtil().ExecutePager(index, size, key, fields, tables, where, orderBy, ref pageCount, ref recordCount);

            var messages = new List <MessageBoard>();

            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                messages.Add(new MessageBoard
                {
                    Name       = GetRowString(dataTable.Rows[i]["Name"]),
                    Homepage   = GetRowString(dataTable.Rows[i]["Homepage"]),
                    QQ         = GetRowString(dataTable.Rows[i]["QQ"]),
                    Phone      = GetRowString(dataTable.Rows[i]["Phone"]),
                    Message    = GetRowString(dataTable.Rows[i]["Message"]),
                    CreateTime = Convert.ToDateTime(dataTable.Rows[i]["CreateTime"])
                });
            }

            return(messages);
        }
예제 #2
0
        public bool SaveMessage(MessageBoard message)
        {
            OleDbParameter[] parameters = GetMessageBoardParams(message);

            string sql = "insert into MessageBoard ([Name],[Homepage],[QQ],[Phone],[Message],[CreateTime]) values (@Name,@Homepage,@QQ,@Phone,@Message,@CreateTime)";

            bool success = new AccessDbUtil().ExeSQL(sql, parameters);

            return(success);
        }