Ejemplo n.º 1
0
        private void addbutton_Click(object sender, EventArgs e)
        {
            string[] date     = DateTime.Now.ToString("MM-dd").Split('-');
            string   monthday = date[0] + date[1];
            string   sql      = "select UserName,Telephone from UserInfo where substring(PersonID,11,4) =" + monthday;

            dataGridView1.DataSource = BirthdayMes.ExcuteQuery(connstr, sql);
            BirthdayMessage.insertMessage(connstr);
        }
Ejemplo n.º 2
0
        //调用接口
        //参数为待使用数据库连接字符串,例如"Server=localhost;Database=TestDB;Trusted_Connection=SSPI"
        public static bool insertMessage(string connectstring)
        {
            bool   result  = false;
            string connstr = connectstring;

            //取出当前系统时间
            string[] date     = DateTime.Now.ToString("MM-dd").Split('-');
            string   monthday = date[0] + date[1];
            string   sql      = "select UserName,Telephone from UserInfo where substring(PersonID,11,4) =" + monthday;
            //执行查询
            DataTable table = BirthdayMes.ExcuteQuery(connstr, sql);

            if (table == null)
            {
                result = false;
            }
            else if (writeMessage(connstr, table) == true)
            {
                result = true;
            }
            return(result);
        }
Ejemplo n.º 3
0
        private void showbutton_Click(object sender, EventArgs e)
        {
            string sql = "select * from UserMessage";

            dataGridView1.DataSource = BirthdayMes.ExcuteQuery(connstr, sql);
        }