Exemplo n.º 1
0
 /// <summary>
 /// 远程升级时,数据库操作
 /// </summary>
 private void RemotUpdate()
 {
     if (WriteData == null)
     {
         return;
     }
     using (DataTable dt = WriteData.Read("select top 1 * from AllTestStationTime"))
     {
         if (dt == null || dt.Columns.Count <= 0)
         {
             WriteData.Write("CREATE TABLE [dbo].[AllTestStationTime](" +
                             "[ID] [bigint] IDENTITY(1,1) NOT NULL," +
                             "	[TestTime] [datetime] NOT NULL,"+
                             "	[TestYear] [int] NULL,"+
                             "	[TestMonth] [int] NULL,"+
                             "	[TestDay] [int] NULL,"+
                             "	[WorkStation] [int] NOT NULL,"+
                             "	[StationName] [nvarchar](100) NULL,"+
                             "	[TimeCount] [int] NULL,"+
                             "	[OperaCount] [int] NULL,"+
                             "CONSTRAINT [PK_AllTestStationTime] PRIMARY KEY CLUSTERED " +
                             "(" +
                             "	[ID] ASC,"+
                             "	[TestTime] ASC,"+
                             "	[WorkStation] ASC"+
                             ")WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]" +
                             ") ON [PRIMARY]");
         }
     }
     using (DataTable dt = WriteData.Read("select top 1 * from AllTestStationTimeEveryHour"))
     {
         if (dt == null || dt.Columns.Count <= 0)
         {
             WriteData.Write("CREATE TABLE [dbo].[AllTestStationTimeEveryHour](" +
                             "	[ID] [bigint] IDENTITY(1,1) NOT NULL,"+
                             "	[TestTime] [datetime] NOT NULL,"+
                             "	[UseTime] [int] NULL,"+
                             "	[WorkStation] [int] NULL,"+
                             "	[StationName] [nvarchar](100) NOT NULL,"+
                             " CONSTRAINT [PK_AllTestStationTimeEveryHour] PRIMARY KEY CLUSTERED" +
                             "(" +
                             "	[ID] ASC,"+
                             "	[TestTime] ASC,"+
                             "	[StationName] ASC"+
                             ")WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]" +
                             ") ON [PRIMARY]");
         }
     }
 }