Ejemplo n.º 1
0
        public static bool Add(RecPictureList recPictureList, ref string errorInfo)
        {
            if (!Access.Connection(ref errorInfo))
            {
                return(false);
            }
            string sql = "insert into RecPictureList ("
                         + "CameraID,"
                         + "RecPictureName,"
                         + "RecPictureDate,"
                         + "RecPictureTime,"
                         + "RecPictureFile,"
                         + "PictureType,"
                         + "UserName,"
                         + "PictureEventName,"
                         + "Description,"
                         + "Mark)"
                         + "values ('"
                         + recPictureList.CameraID + "','"
                         + recPictureList.RecPictureName + "','"
                         + recPictureList.RecPictureDate + "','"
                         + recPictureList.RecPictureTime + "','"
                         + recPictureList.RecPictureFile + "','"
                         + recPictureList.PictureType + "','"
                         + recPictureList.UserName + "','"
                         + recPictureList.PictureEventName + "','"
                         + recPictureList.Description + "','"
                         + recPictureList.Mark + "'"
                         + ")";
            //往表添加一条记录
            OleDbCommand oleDbCommand = new OleDbCommand(sql, Access.oleDb);
            int          i            = oleDbCommand.ExecuteNonQuery(); //返回被修改的数目

            return(i > 0);
        }
Ejemplo n.º 2
0
        private static void Form_SetupValueEvent(string eventType, string Description)
        {
            //存储截图信息到本地
            DateTime       dt             = DateTime.Now;
            RecPictureList recPictureList = new RecPictureList();

            recPictureList.CameraID       = CameraID;
            recPictureList.RecPictureName = sBmpPicFileName;
            recPictureList.RecPictureDate = dt.ToString("yyyy-MM-dd");
            recPictureList.RecPictureTime = dt.ToString("HH:mm:ss");
            recPictureList.RecPictureFile = path + sBmpPicFileName;
            recPictureList.PictureType    = "截图";
            string errorInfo = "";

            if (!RecPictureClass.Add(recPictureList, ref errorInfo))
            {
                MessageBox.Show(errorInfo);
            }
            else
            {
                MessageBox.Show("保存成功!");
            }
        }