Shanghai Mitsubishi Elevator Co., Ltd(上海三菱电梯有限公司) 的 Comprehensive Elevator Monitoring System (电梯综合监控系统) 程序由于需要处理的数据数据结构发生改变,导致无法使用高版本直接访问数据库,及进行编辑查看等操作。下面记录了一些尝试,已解决这个问题。

win10 系统在接入了 LonWorks TP/FT-10 USB 网卡后,使用其他版本 LonEle.exe以管理员身份运行访问时,可能会得到如下错误提示。

Alarm
---------------------------
System initialization error, the program will stop running!(4)
---------------------------
确定
---------------------------

或者说——

---------------------------

警告

---------------------------

系统初始化错误,程序将停止运行!(4)

---------------------------

确定

---------------------------

若以非管理员身份运行可能会提示“系统初始化错误,程序将停止运行!(6)”。

使用 SSMS 2005 等数据库管理工具,访问.\lonele2 本机数据库,以 SQL Server 身份验证方式(登录名 sa,密码为 lonele)。

使用 AdeptSQL Diff 等工具比较目标版本的表中不含数据数据库与源版本的数据库。可得

Difference summary, by object category

Category Total items Identical Changed Left-only Right-only
Tables 38 36 2 0 0
Views 14 13 1 0 0
Procedures 142 133 9 0 7
Principals 2 1 1 0 0
File groups 1 1 0 0 0

Tables 中 CardPublicInfo、CardSpecificInfo 表中列有增加。

Views 中 vCardInfo 中增加了一列。

Procedures 中 新增了 prGetPinfoNumberDLprogress、prGetPinfoNumberForDL、prSetAllCardSpecificInfoNumberDownloadSts、prSetCardInfoNumberDownloadSts、prSetCardSpecificInfoNumberDownloadSts、prUpdate_CardPublicInfoNumber、prUpdate_CardSpecificInfoNumberDownloadSts 共 7 个存储过程,及修改了 prInsertUpdate_CardPublicInfo、prInsertUpdate_CardSpecificInfo 共 2 个存储过程。

Principals 的差异则是 exec sp_grantdbaccess 'NT AUTHORITY\SYSTEM', 'dbo'; 变成了 exec sp_grantdbaccess 'sa', 'dbo';

数据库的修改顺序关系着能否将问题解决,经测试可先修改 CardSpecificInfo。需要先备份数据库,可进行完整备份BACKUP DATABASE lonele TO DISK = 'C:\lonele20180418_00.bak',接着执行修改表的操作。

修改 CardSpecificInfo 表及相应存储过程。

set xact_abort on;
go begin transaction;
go alter table CardSpecificInfo add
Number_DownloadSts tinyint not null constraint DFX_02459978 default(0);
go set ANSI_NULLS on;
go alter Procedure prGetCardSpecificInfo
/* Param List */
@intCard_ID int
AS
/******************************************************************************
** File: prGetCardSpecificInfo.sql
** Name: prGetCardSpecificInfo
** Desc: 获取指定卡号的专用信息
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** Card_ID[卡号]
**
** Auth: zjd
** Date: 2004/10/10
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/
SELECT *
FROM CardSpecificInfo
WHERE Card_ID = @intCard_ID
go alter Procedure prDelete_CardSpecificInfo
/* Param List */
(@intCard_ID int,
@insCard_NodeID smallint)
AS
/******************************************************************************
** File: prDelete_CardSpecificInfo.sql
** Name: prDelete_CardSpecificInfo
** Desc: 删除指定卡的专用信息
**
** This template can be customized:
**
** Return values: ErrorCode (0 成功,非0 失败)
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** Card_ID[卡号]
** Card_NodeID[节点编号]
**
** Auth: zjd
** Date: 2004/09/08
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/
SET NOCOUNT ON
DECLARE @intErrorCode int,
@intTransactionCountOnEntry int,
@intRowCount int SELECT @intErrorCode = @@ERROR
IF @intErrorCode = 0
BEGIN
SELECT @intTransactionCountOnEntry = @@TRANCOUNT
BEGIN TRANSACTION
END
IF @intErrorCode = 0
BEGIN
DELETE CardSpecificInfo
WHERE Card_ID = @intCard_ID AND Card_NodeID = @insCard_NodeID SELECT @intRowCount = @@ROWCOUNT
SELECT @intErrorCode = @@ERROR
END
IF @@TRANCOUNT > @intTransactionCountOnEntry
BEGIN
IF @intErrorCode = 0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION
END
-- 检查是否有一条记录被删除。
IF @intRowCount <> 1
RETURN 1
ELSE
RETURN @intErrorCode
go alter Procedure prClearAllPinfo
/* Param List */
AS /******************************************************************************
** File: prClearAllPinfo.sql
** Name: prClearAllPinfo
** Desc: remove all card information in cardpublicinfo and cardspecificinfo
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
**
** Auth: zjd
** Date: 2005/12/02
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SET NOCOUNT ON
DECLARE @intErrorCode int -- TRUNCATE TABLE CardSpecificInfo
Delete CardSpecificInfo -- TRUNCATE TABLE CardPublicInfo
Delete CardPublicInfo SELECT @intErrorCode = @@ERROR RETURN @intErrorCode
go create Procedure prUpdate_CardSpecificInfoNumberDownloadSts
/* Param List */
(@insCard_NodeID smallint,
@inyDownloadSts tinyint)
AS /******************************************************************************
** File: prUpdate_CardSpecificInfoDownloadSts.sql
** Name: prUpdate_CardSpecificInfoDownloadSts
** Desc:
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** NodeID[节点编号]
** DownloadSts[下载状态]
**
** Auth: zjd
** Date: 2005/12/07
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SET NOCOUNT ON
DECLARE @intErrorCode int,
@intTransactionCountOnEntry int,
@intRowCount int SELECT @intErrorCode = @@ERROR
IF @intErrorCode = 0
BEGIN
SELECT @intTransactionCountOnEntry = @@TRANCOUNT
BEGIN TRANSACTION
END IF @intErrorCode = 0
BEGIN
UPDATE CardSpecificInfo
SET Number_DownloadSts = @inyDownloadSts
WHERE Card_NodeID = @insCard_NodeID SELECT @intRowCount = @@ROWCOUNT
SELECT @intErrorCode = @@ERROR
END IF @@TRANCOUNT > @intTransactionCountOnEntry
BEGIN
IF @intErrorCode = 0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION
END -- 检查是否有一条记录被更新。
-- IF @intRowCount = 0
-- RETURN 1
-- ELSE
RETURN @intErrorCode
go alter VIEW vCardInfo
AS
SELECT dbo.CardPublicInfo.*, dbo.CardSpecificInfo.Card_NodeID,
dbo.CardSpecificInfo.Card_AccessClassID, dbo.CardSpecificInfo.Card_Floors,
dbo.CardSpecificInfo.Card_DownloadSts,dbo.CardSpecificInfo.Number_DownloadSts
FROM dbo.CardPublicInfo INNER JOIN
dbo.CardSpecificInfo ON dbo.CardPublicInfo.Card_ID = dbo.CardSpecificInfo.Card_ID
go create Procedure prSetCardSpecificInfoNumberDownloadSts
/* Param List */
(@insCard_ID int,
@insCard_NodeID smallint,
@inyDownloadSts tinyint)
AS /******************************************************************************
** File: prSetCardSpecificInfoDownloadSts.sql
** Name: prSetCardSpecificInfoDownloadSts
** Desc:
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** Card_ID[卡号]
** Card_NodeID[节点编号]
** DownloadSts[下载状态]
**
** Auth: zjd
** Date: 2005/12/07
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SET NOCOUNT ON
DECLARE @intErrorCode int,
@intTransactionCountOnEntry int,
@intRowCount int SELECT @intErrorCode = @@ERROR
IF @intErrorCode = 0
BEGIN
SELECT @intTransactionCountOnEntry = @@TRANCOUNT
BEGIN TRANSACTION
END IF @intErrorCode = 0
BEGIN
UPDATE CardSpecificInfo
SET Number_DownloadSts = @inyDownloadSts
WHERE Card_ID = @insCard_ID AND Card_NodeID = @insCard_NodeID SELECT @intRowCount = @@ROWCOUNT
SELECT @intErrorCode = @@ERROR
END IF @@TRANCOUNT > @intTransactionCountOnEntry
BEGIN
IF @intErrorCode = 0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION
END -- 检查是否有一条记录被更新。
IF @intRowCount = 0
RETURN 1
ELSE
RETURN @intErrorCode
go create Procedure prSetCardInfoNumberDownloadSts
/* Param List */
(@intCard_ID int,
@inyDownloadSts tinyint)
AS /******************************************************************************
** File: prSetCardInfoDownloadSts.sql
** Name: prSetCardInfoDownloadSts
** Desc: 设置非接触卡信息下载标志(下载标志在CardSpecificInfo表中,因为是针对节点而言的)
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** Card_ID[卡号]
** DownloadSts[下载状态]
**
** Auth: zjd
** Date: 2004/12/01
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/
SET NOCOUNT ON
DECLARE @intErrorCode int,
@intTransactionCountOnEntry int,
@intRowCount int SELECT @intErrorCode = @@ERROR
IF @intErrorCode = 0
BEGIN
SELECT @intTransactionCountOnEntry = @@TRANCOUNT
BEGIN TRANSACTION
END
IF @intErrorCode = 0
BEGIN
UPDATE CardSpecificInfo
SET Number_DownloadSts = @inyDownloadSts
WHERE Card_ID = @intCard_ID SELECT @intRowCount = @@ROWCOUNT
SELECT @intErrorCode = @@ERROR
END
IF @@TRANCOUNT > @intTransactionCountOnEntry
BEGIN
IF @intErrorCode = 0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION
END RETURN @intErrorCode
go create Procedure prSetAllCardSpecificInfoNumberDownloadSts
/* Param List */
@inyDownloadSts tinyint
AS /******************************************************************************
** File: prSetAllCardSpecificInfoDownloadSts.sql
** Name: prSetAllCardSpecificInfoDownloadSts
** Desc:
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
**
** Auth: zjd
** Date: 2005/12/07
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SET NOCOUNT ON
DECLARE @intErrorCode int UPDATE CardSpecificInfo
SET Number_DownloadSts = @inyDownloadSts SELECT @intErrorCode = @@ERROR RETURN @intErrorCode
go alter Procedure prSetAllCardSpecificInfoDownloadSts
/* Param List */
@inyDownloadSts tinyint
AS /******************************************************************************
** File: prSetAllCardSpecificInfoDownloadSts.sql
** Name: prSetAllCardSpecificInfoDownloadSts
** Desc:
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
**
** Auth: zjd
** Date: 2005/12/07
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SET NOCOUNT ON
DECLARE @intErrorCode int UPDATE CardSpecificInfo
SET Card_DownloadSts = @inyDownloadSts SELECT @intErrorCode = @@ERROR RETURN @intErrorCode
go alter Procedure prInsertUpdate_CardSpecificInfo
/* Param List */
(@intCard_ID int,
@insCard_NodeID smallint,
@inyAccessClassID tinyint,
@binFloors binary(8),
@inyDownloadSts tinyint,
@inyNumberDownloadSts tinyint)
AS /******************************************************************************
** File: prInsertUpdate_CardSpecificInfo.sql
** Name: prInsertUpdate_CardSpecificInfo
** Desc: 更新非接触卡的私有信息,若无指定编号的记录,则添加一条。
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** Card_ID[卡号]
** Card_NodeID[节点编号]
** AccessClassID[通行等级编号]
** Floors[可去楼层]
** DownloadSts[下载状态]
**
** Auth: zjd
** Date: 2005/12/05
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/
SET NOCOUNT ON
DECLARE @intErrorCode int,
@intTransactionCountOnEntry int,
@intCount int,
@intRowCount int -- 检查所需设置的通行等级是否被定义过
IF @inyAccessClassID <> 0
BEGIN
SELECT @intCount = (SELECT COUNT(AC_ID) FROM AccessClass WHERE AC_ID = @inyAccessClassID)
IF @intCount = 0
RETURN 1
END SELECT @intCount = (SELECT COUNT(Card_ID) FROM CardSpecificInfo WHERE Card_ID = @intCard_ID AND Card_NodeID = @insCard_NodeID) IF @intCount = 0
/* Insert CardSpecificInfo */
INSERT CardSpecificInfo(Card_ID,
Card_NodeID,
Card_AccessClassID,
Card_Floors,
Card_DownloadSts,
Number_DownloadSts)
VALUES (@intCard_ID,
@insCard_NodeID,
@inyAccessClassID,
@binFloors,
@inyDownloadSts,
@inyNumberDownloadSts)
ELSE
/* Update CardPublicInfo of Specified Card_ID */
UPDATE CardSpecificInfo
SET Card_AccessClassID = @inyAccessClassID,
Card_Floors = @binFloors,
Card_DownloadSts = @inyDownloadSts,
Number_DownloadSts=@inyNumberDownloadSts
WHERE Card_ID = @intCard_ID AND Card_NodeID = @insCard_NodeID SELECT @intRowCount = @@ROWCOUNT
SELECT @intErrorCode = @@ERROR -- 检查是否有一条记录被更新。
IF @intRowCount <> 1
RETURN 1
ELSE
RETURN @intErrorCode
go alter Procedure prGetSInfoByNodeID
/* Param List */
@insNodeID smallint
AS /******************************************************************************
** File: prGetSInfoByNodeID.sql
** Name: prGetSInfoByNodeID
** Desc: get all ncrcardrights of this node
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
**
** Auth: zjd
** Date: 2005/12/02
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SELECT *
FROM CardSpecificInfo
WHERE Card_NodeID = @insNodeID
go alter Procedure prGetCardSpecificInfoDownloadSts
/* Param List */
@insNodeID smallint
AS /******************************************************************************
** File: prGetCardSpecificInfoDownloadSts.sql
** Name: prGetCardSpecificInfoDownloadSts
** Desc: 获取指定NCR节点的个人信息下载状态
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** NodeID[节点编号]
**
** Auth: zjd
** Date: 2005/10/18
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SELECT *
FROM CardSpecificInfo
WHERE Card_NodeID = @insNodeID
go alter table CardSpecificInfo drop
constraint DFX_02459978;
go commit;
go

需要注意的是具体查询中以 DFX_ 为前缀后跟 8 位 16 进制的默认约束可能与上述不同。执行上述查询以修改表后,修改日期为 2019 年 3 月 28 日的LonELe.exe 程序就可以打开登录,进而访问相应的电梯卡等信息了。

当然也可以继续对数据库进行修改。

修改 CardPublicInfo 表及相应存储过程。

set xact_abort on;
go begin transaction;
go alter table CardPublicInfo add
Number smallint not null constraint DFX_03FA3B38 default(0),
Building_No smallint not null constraint DFX_03FA3B88 default(0);
go set ANSI_NULLS on;
go alter Procedure prGetCardPublicInfo
/* Param List */
@intCard_ID int
AS
/******************************************************************************
** File: prGetCardPublicInfo.sql
** Name: prGetCardPublicInfo
** Desc: 获取指定卡号的基本信息
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** Card_ID[卡号]
**
** Auth: zjd
** Date: 2004/10/09
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/
SELECT *
FROM CardPublicInfo
WHERE Card_ID = @intCard_ID
go alter Procedure prGetAllPCardsExceptNode
/* Param List */
@insNode_ID smallint
AS /******************************************************************************
** File: prGetAllPCardsExceptNode.sql
** Name: prGetAllPCardsExceptNode
** Desc: get all public information except the cards have been added to this node
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** NodeID[节点编号]
**
** Auth: zjd
** Date: 2005/12/01
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SELECT *
FROM CardPublicInfo
WHERE Card_ID NOT IN (SELECT Card_ID FROM CardSpecificInfo WHERE Card_NodeID = @insNode_ID)
go alter Procedure prGetAllPCards
/* Param List */
AS /******************************************************************************
** File: prGetAllPCards.sql
** Name: prGetAllPCards
** Desc: get public infomation of all cards
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
**
** Auth: zjd
** Date: 2005/12/01
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SELECT *
FROM CardPublicInfo
go alter Procedure prDelete_CardPublicInfo
/* Param List */
@intCard_ID int
AS
/******************************************************************************
** File: prDelete_CardPublicInfo.sql
** Name: prDelete_CardPublicInfo
** Desc: 删除指定卡的公用信息
**
** This template can be customized:
**
** Return values: ErrorCode (0 成功,非0 失败)
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** Card_ID[卡号]
**
** Auth: zjd
** Date: 2004/09/08
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/
SET NOCOUNT ON
DECLARE @intErrorCode int,
@intTransactionCountOnEntry int,
@intRowCount int SELECT @intErrorCode = @@ERROR
IF @intErrorCode = 0
BEGIN
SELECT @intTransactionCountOnEntry = @@TRANCOUNT
BEGIN TRANSACTION
END
IF @intErrorCode = 0
BEGIN
DELETE CardPublicInfo
WHERE Card_ID = @intCard_ID SELECT @intRowCount = @@ROWCOUNT
SELECT @intErrorCode = @@ERROR
END
IF @@TRANCOUNT > @intTransactionCountOnEntry
BEGIN
IF @intErrorCode = 0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION
END
-- 检查是否有一条记录被删除。
IF @intRowCount <> 1
RETURN 1
ELSE
RETURN @intErrorCode
go alter Procedure prClearAllPinfo
/* Param List */
AS /******************************************************************************
** File: prClearAllPinfo.sql
** Name: prClearAllPinfo
** Desc: remove all card information in cardpublicinfo and cardspecificinfo
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
**
** Auth: zjd
** Date: 2005/12/02
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SET NOCOUNT ON
DECLARE @intErrorCode int -- TRUNCATE TABLE CardSpecificInfo
Delete CardSpecificInfo -- TRUNCATE TABLE CardPublicInfo
Delete CardPublicInfo SELECT @intErrorCode = @@ERROR RETURN @intErrorCode
go alter VIEW vCardInfo
AS
SELECT dbo.CardPublicInfo.*, dbo.CardSpecificInfo.Card_NodeID,
dbo.CardSpecificInfo.Card_AccessClassID, dbo.CardSpecificInfo.Card_Floors,
dbo.CardSpecificInfo.Card_DownloadSts,dbo.CardSpecificInfo.Number_DownloadSts
FROM dbo.CardPublicInfo INNER JOIN
dbo.CardSpecificInfo ON dbo.CardPublicInfo.Card_ID = dbo.CardSpecificInfo.Card_ID
go alter Procedure prInsertUpdate_CardPublicInfo
/* Param List */
(@intCard_ID int,
@inyPublicshTimes tinyint,
@inyAccidentMark tinyint,
@dtsBeginDate smalldatetime,
@dtsEndDate smalldatetime,
@chvnOwnerName nvarchar(30),
@chvnOwnerInfo nvarchar(60),
@inyDeleted tinyint,
@insNumber smallint,
@insBuildingNo smallint)
AS /******************************************************************************
** File: prInsertUpdate_CardPublicInfo.sql
** Name: prInsertUpdate_CardPublicInfo
** Desc: 更新非接触卡的公共信息,若无指定编号的记录,则添加一条。
**
** This template can be customized:
**
** Return values: ErrorCode (0 成功,非0 失败)
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** Card_ID[卡号]
** PublicshTimes[发行次数]
** AccidentMark[事故标记]
** BeginDate[有效开始时间]
** EndDate[有效结束时间]
** OwnerName[持卡人姓名]
** OwnerInfo[持卡人信息]
** Deleted[是否被删除]
**
** Auth: zjd
** Date: 2004/12/01
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SET NOCOUNT ON DECLARE @intErrorCode int,
@intTransactionCountOnEntry int,
@intCount int,
@intRowCount int SELECT @intErrorCode = @@ERROR IF @intErrorCode = 0
BEGIN
SELECT @intTransactionCountOnEntry = @@TRANCOUNT
BEGIN TRANSACTION
END IF @intErrorCode = 0
BEGIN
SELECT @intCount = (SELECT COUNT(Card_ID) FROM CardPublicInfo WHERE Card_ID = @intCard_ID)
SELECT @intErrorCode = @@ERROR
END IF @intErrorCode = 0
BEGIN
IF @intCount = 0
/* Insert CardPublicInfo */
INSERT CardPublicInfo(Card_ID,
Card_PublishTimes,
Card_AccidentMark,
Card_BeginDate,
Card_EndDate,
Card_OwnerName,
Card_OwnerInfo,
Card_Deleted,
Number,
Building_No)
VALUES (@intCard_ID,
@inyPublicshTimes,
@inyAccidentMark,
@dtsBeginDate,
@dtsEndDate,
@chvnOwnerName,
@chvnOwnerInfo,
@inyDeleted,
@insNumber,
@insBuildingNo)
ELSE
/* Update CardPublicInfo of Specified Card_ID */
UPDATE CardPublicInfo
SET Card_PublishTimes = @inyPublicshTimes,
Card_AccidentMark = @inyAccidentMark,
Card_BeginDate = @dtsBeginDate,
Card_EndDate = @dtsEndDate,
Card_OwnerName = @chvnOwnerName,
Card_OwnerInfo = @chvnOwnerInfo,
Card_Deleted = @inyDeleted,
Number=@insNumber,
Building_No=@insBuildingNo
WHERE Card_ID = @intCard_ID SELECT @intRowCount = @@ROWCOUNT
SELECT @intErrorCode = @@ERROR
END IF @@TRANCOUNT > @intTransactionCountOnEntry
BEGIN
IF @intErrorCode = 0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION
END -- 检查是否有一条故障记录被更新或被插入。
IF @intRowCount <> 1
RETURN 1
ELSE
RETURN @intErrorCode
go alter table CardPublicInfo drop
constraint DFX_03FA3B88;
go create Procedure prUpdate_CardPublicInfoNumber
/* Param List */
(@intCard_ID int,
@insNumber smallint)
AS /******************************************************************************
** File: prUpdate_EleSet.sql
** Name: prUpdate_EleSet
** Desc: 更改电梯组名称和组用途
**
** This template can be customized:
**
** Return values: ErrorCode (0 成功,非0 失败)
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** Set_ID[组编号]
** Name[组名称]
** Usage[组用途]
**
** Auth: zjd
** Date: 2004/08/30
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
** 2013/11/15 zjd Add column Set_Usage
*******************************************************************************/ SET NOCOUNT ON DECLARE @intErrorCode int,
@intTransactionCountOnEntry int,
@intRowCount int SELECT @intErrorCode = @@ERROR IF @intErrorCode = 0
BEGIN
SELECT @intTransactionCountOnEntry = @@TRANCOUNT
BEGIN TRANSACTION
END IF @intErrorCode = 0
BEGIN
UPDATE CardPublicInfo
SET Number = @insNumber
WHERE Card_ID = @intCard_ID SELECT @intRowCount = @@ROWCOUNT
SELECT @intErrorCode = @@ERROR
END IF @@TRANCOUNT > @intTransactionCountOnEntry
BEGIN
IF @intErrorCode = 0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION
END -- 检查是否有一条记录被更新。
IF @intRowCount <> 1
RETURN 1
ELSE
RETURN @intErrorCode
go alter table CardPublicInfo drop
constraint DFX_03FA3B38;
go commit;
go

还剩两个存储过程 Procedure prGetPinfoNumberDLprogress、prGetPinfoNumberForDL 有待创建。

创建 Procedure prGetPinfoNumberDLprogress 存储过程。

set xact_abort on;
go begin transaction;
go set ANSI_NULLS on;
go create Procedure prGetPinfoNumberDLprogress
/* Param List */
(@inyProgress as tinyint = 0 OUTPUT,
@insNodeID as smallint,
@inyDownloadSts as tinyint)
AS /******************************************************************************
** File: prGetPinfoDLprogress.sql
** Name: prGetPinfoDLprogress
** Desc: Get public infomation download progress.
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
**
** Auth: zjd
** Date: 2006/03/02
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ SET NOCOUNT ON DECLARE @intErrorCode int,
@intTotalNum int,
@intTransactionCountOnEntry int,
@intCurrentNum int SELECT @intErrorCode = @@ERROR IF @intErrorCode = 0
BEGIN
SELECT @intTransactionCountOnEntry = @@TRANCOUNT
BEGIN TRANSACTION
END IF @intErrorCode = 0
BEGIN
SELECT @intTotalNum = (SELECT COUNT(*) FROM vCardInfo WHERE Card_NodeID = @insNodeID)
SELECT @intCurrentNum = (SELECT COUNT(*) FROM vCardInfo WHERE Card_NodeID = @insNodeID AND Number_DownloadSts = @inyDownloadSts)
SELECT @inyProgress = ROUND((@intCurrentNum*100)/@intTotalNum,2) SELECT @intErrorCode = @@ERROR
END IF @@TRANCOUNT > @intTransactionCountOnEntry
BEGIN
IF @intErrorCode = 0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION
END RETURN @intErrorCode
go commit;
go

创建 prGetPinfoNumberForDL 存储过程

set xact_abort on;
go begin transaction;
go set ANSI_NULLS on;
go create Procedure prGetPinfoNumberForDL
/* Param List */
(@insNodeID as smallint,
@inyDownloadSts as tinyint,
@inyNumberDownloadSts as tinyint,
@BatchSize as integer = 2)
AS /******************************************************************************
** File: prGetPinfoForDL.sql
** Name: prGetPinfoForDL
** Desc:
**
** This template can be customized:
**
** Return values:
**
** Called by:
**
** Parameters:
** Input Output
** ---------- -----------
** NodeID[节点编号]
** DownloadSts[下载标记]
** BatchSize[要获取的记录数]
**
** Auth: zjd
** Date: 2005/12/07
*******************************************************************************
** Change History
*******************************************************************************
** Date: Author: Description:
** -------- -------- -------------------------------------------
**
*******************************************************************************/ set CONCAT_NULL_YIELDS_NULL OFF
-- set nocount on declare @chvSelect varchar(8000),
@chvFrom varchar(8000),
@chvWhere varchar(8000),
@chvOrderby varchar(8000),
@chvSQL varchar(8000) set @chvSelect = 'SELECT top ' + Convert(varchar, @BatchSize)
+ ' * '
set @chvFrom = ' FROM vCardInfo '
set @chvWhere = ' WHERE Card_NodeID = ' + Convert(varchar,@insNodeID) + ' AND Card_DownloadSts = ' + Convert(varchar,@inyDownloadSts)+' AND Number_DownloadSts = ' + Convert(varchar,@inyNumberDownloadSts)
set @chvOrderBy = ' ORDER BY Card_ID ASC'
set @chvSQL = @chvSelect + @chvFrom + @chvWhere + @chvOrderBy exec (@chvSQL)
go commit;
go

在电梯综合监控程序的登录界面上,如果忘记了管理程序的登录密码,可以按住 ctrl + shift 在空白处单击 3-4次,输入操作员账号 smec,密码为 200236。

LonEle 操作的 SQL Server 数据库(msde2000)由 20180418 版更新至 20190328 版(非官方)的更多相关文章

  1. C#操作access和SQL server数据库代码实例

    在C#的学习中,操作数据库是比较常用的技术,而access和sql server 数据库的操作却有着不同.那么,有哪些不同呢? 首先,需要引用不同的类.因为有着不同的数据引擎. access:usin ...

  2. SQL Server数据库远程操作

    SQL Server数据库远程操作中,在使用openrowset/opendatasource前首先要启用Ad Hoc Distributed Queries服务,因为这个服务不安全所以SqlServ ...

  3. 对于超大型SQL SERVER数据库执行DBCC操作

    原文:对于超大型SQL SERVER数据库执行DBCC操作 对于数据库维护,主要使用DBCC CHECKDB来实现,以下是对大型数据库的使用说明,小型数据库一般直接使用就可以了: 1.2008(200 ...

  4. 详解连接SQL Server数据库的方法,并使用Statement接口实现对数据库的增删改操作

    总结一下,连接SQL Server数据库需要以下几个步骤: 1. 导入驱动Jar包:sqljdbc.jar 2. 加载并注册驱动程序 3. 设置连接路径 4. 加载并注册驱动 5. 连接数据库 6. ...

  5. SQL Server学习之路(七):Python3操作SQL Server数据库

    0.目录 1.前言 2.准备工作 3.简单测试语句 4.提交与回滚 5.封装成类的写法 1.前言 前面学完了SQL Server的基本语法,接下来学习如何在程序中使用sql,毕竟不能在程序中使用的话, ...

  6. 基于Spring Boot,使用JPA操作Sql Server数据库完成CRUD

    完成一个RESTful服务,提供几个访问接口,用来操作较简单的联系人信息,数据保存在Sql Server数据库中. 1.使用STS创建工程. 使用STS创建RESTful工程,可以参考: <用S ...

  7. 解决SQL SERVER数据库备份时出现“操作系统错误5(拒绝访问)。BACKUP DATABASE 正在异常终止。”错误的解决办法

    SQL SERVER数据库进行备份时出现“操作系统错误5(拒绝访问).BACKUP DATABASE 正在异常终止.”错误.我们应该如何解决这个问题?小编今天为大家推荐一个解决办法. 一般备份文件选择 ...

  8. 【转】sql server数据库操作大全——常用语句/技巧集锦/经典语句

    本文为累计整理,有点乱,凑合着看吧! ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ ☆ ☆ ☆ sql 宝 典 ☆ ☆ ☆ 2012年-8月 修订版 ☆ ...

  9. [转]C#操作SQL Server数据库

    转自:C#操作SQL Server数据库 1.概述 ado.net提供了丰富的数据库操作,这些操作可以分为三个步骤: 第一,使用SqlConnection对象连接数据库: 第二,建立SqlComman ...

  10. Python 学习笔记:Python 操作 SQL Server 数据库

    最近要将数据写到数据库里,学习了一下如何用 Python 来操作 SQL Server 数据库. 一.连接数据库: 首先,我们要连接 SQL Server 数据库,需要安装 pymssql 这个第三方 ...

随机推荐

  1. Git使用经验总结6-删除远端历史记录

    删除远端的历史记录但是不影响最新的仓库内容是笔者一直想实现的功能,有两个很不错的用处: 有的历史提交不慎包含了比较敏感的信息,提交的时候没注意,过了一段时间才发现.这个时候已经有了很多新的历史提交,无 ...

  2. CSS – Position

    前言 定位是 CSS 里蛮重要的一课. 图片黑影 (overlay), back to top button, header, footer 紧贴在屏幕上下方等效果都是靠 position 完成的. ...

  3. mongo集群同步数据异常,手动同步节点副本数据

    转载请注明出处: 数据同步方案 当副本集节点的复制进程落后太多,以至于主节点覆盖了该节点尚未复制的 oplog 条目时,副本集节点就会变为"陈旧".节点跟不上,就会变得" ...

  4. 面试官的几句话,差点让我挂在HTTPS上

    作为软件测试,大家都知道一些常用的网络协议是我们必须要了解和掌握的,比如 HTTP 协议,HTTPS 协议就是两个使用非常广泛的协议,所以也是面试官问的面试的时候问的比较多的两个协议:而且因为这两个协 ...

  5. ArgoWorkflow教程(五)---Workflow 的多种触发模式:手动、定时任务与事件触发

    上一篇我们分析了argo-workflow 中的 archive,包括 流水线GC.流水线归档.日志归档等功能.本篇主要分析 Workflow 中的几种触发方式,包括手动触发.定时触发.Event 事 ...

  6. .NET 8.0 酒店管理系统设计与实现

    前言 给大家推荐一个基于.NET 8.0 的中小型酒店设计的管理系统. 随着酒店的日常工作增加,很难用人工去进行处理一些繁琐的数据,也可能会因为人工的失误而造成酒店的损失,因此需要一款可以协助酒店进行 ...

  7. ptmalloc、tcmalloc与jemalloc对比分析

    背景介绍 在开发微信看一看期间,为了进行耗时优化,基础库这层按照惯例使用tcmalloc替代glibc标配的ptmalloc做优化,CPU消耗和耗时确实有所降低.但在晚上高峰时期,在CPU刚刚超过50 ...

  8. icache的dcache区别

    iCache是指指令缓存,DCache是指数据缓存.iCache是专门用于存储指令的高速缓存,DCache是用于存储数据的高速缓存.iCache用于存储指令,在CPU执行时将指令从iCache中读取, ...

  9. Java日期时间API系列27-----Jdk8中java.time包中的新的日期时间API类,使用xk-time工具类创建日历应用,自定义节假日,工作日和打印日历表。

    1.日历相关类 1.1 日历类 CalendarWrapper package com.xkzhangsan.time.calendar; import java.io.Serializable; i ...

  10. 云原生周刊:Harbor v2.11 版本发布 | 2024.6.17

    开源项目推荐 Descheduler Descheduler 是一个工具,可用于优化 Kubernetes 集群中 Pod 的部署位置.它可以找到可以移动的 Pod,并将其驱逐,让默认调度器将它们重新 ...