Ejemplo n.º 1
0
 public DateTime GetServerDateTime()
 {
     string str = "select getdate() as serverDate";
     DatabaseCmd datacmd = new DatabaseCmd();
     SqlDataReader myreader;
     try
     {
         datacmd.SqlExecuteReader(str, out myreader);
         if (myreader.Read())
         {
             return myreader.GetDateTime(0);
         }
         else
         {
             return DateTime.Now;
         }
     }
     catch (Exception ex)
     {
         return DateTime.Now;
         //MessageBox.Show(ex.Message);
     }
     finally
     {
         datacmd.SqlReaderClose();
     }
 }
Ejemplo n.º 2
0
        }         //从数据库中把二进制流读出写入还原成文件

        public DateTime GetServerDateTime()
        {
            string        str     = "select getdate() as serverDate";
            DatabaseCmd   datacmd = new DatabaseCmd();
            SqlDataReader myreader;

            try
            {
                datacmd.SqlExecuteReader(str, out myreader);
                if (myreader.Read())
                {
                    return(myreader.GetDateTime(0));
                }
                else
                {
                    return(DateTime.Now);
                }
            }
            catch (Exception ex)
            {
                return(DateTime.Now);
                //MessageBox.Show(ex.Message);
            }
            finally
            {
                datacmd.SqlReaderClose();
            }
        }
Ejemplo n.º 3
0
 public bool GetBinaryFromDatabase(string ID, string Ext, int Version, bool isModel, string outPath)
 {
     Byte[] ByteFile = null;
     string sqlstr = "select Data from [VehicleGeoInfo] where 汽车ID ='" + ID + "' and Ext ='" + Ext + "' and 版本=" + Version + " and 是否模板 ='" + isModel + "'";
     DatabaseCmd databasecmd = new DatabaseCmd();
     SqlDataReader myreader;
     databasecmd.SqlExecuteReader(sqlstr, out myreader);
     if(myreader.Read())
     {
         ByteFile = (byte[])myreader[0];
         BinaryToFile(ByteFile, outPath);
     }
     return true;
 }
Ejemplo n.º 4
0
        public bool GetBinaryFromDatabase(string ID, string Ext, int Version, bool isModel, string outPath)
        {
            Byte[]        ByteFile    = null;
            string        sqlstr      = "select Data from [VehicleGeoInfo] where 汽车ID ='" + ID + "' and Ext ='" + Ext + "' and 版本=" + Version + " and 是否模板 ='" + isModel + "'";
            DatabaseCmd   databasecmd = new DatabaseCmd();
            SqlDataReader myreader;

            databasecmd.SqlExecuteReader(sqlstr, out myreader);
            if (myreader.Read())
            {
                ByteFile = (byte[])myreader[0];
                BinaryToFile(ByteFile, outPath);
            }
            return(true);
        }