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. 5.5文件上传-WAF绕过

    一.WAF绕过(明确有文件上传) 1.上传参数中,可修改参数 Content-Dispositin:一般可改 name:表单参数,不可更改 filename:文件名,可更改 Content-Type: ...

  2. C++:使自定义类支持迭代器

    概述 在 C++ 中,链表迭代器是一种用来遍历链表(如 std::list)元素的工具.链表是一种数据结构,其中每个元素(节点)包含一个数据值和一个指向下一个节点的指针.链表迭代器允许以类似于数组的方 ...

  3. canvas图片旋转扩展出原生JS实现移动端横竖屏手写签名示例

    前提知识 canvas是提供了各种各样的接口去控制画布,比如旋转rotate方法. 这里的旋转并不是真的把这个画布旋转了,例如ctx.rotate(90 * Math.PI / 180)顺时针旋转90 ...

  4. 击败全球上千参赛队伍,合合信息获ICDAR“文本篡改检测”赛道冠军

    AI技术的快速发展激发了人们对于美好未来的畅享,也带来了潜在的危机,数据泄露.电信诈骗等系列风险与隐患开始浮出水面.利用科技手段构建可信的技术发展环境,保护使用者的信息及财产安全,正在成为行业共识. ...

  5. Filter——过滤器

    Filter       Filter 快速入门    Filter 执行流程           1.放行前,对 request 数据进行处理     2.放行后,对 response 数据进行处理 ...

  6. 编写自己的简易版网络协议栈(1)--arp协议,使用wireshark抓包分析

    实验环境: 略. 实验背景:已编写好基于以太网接口的输入处理,能够解析到以太网数据包内的帧类型. 1. 协议栈底层采用轮询方式,即轮询以太网数据包. 2. 若收到数据,则交由以太网输入处理模块进行解析 ...

  7. Outlook无法接收发送邮件,报错超出最大空间 的解决办法

    事件起因: 某客户的outlook邮箱无法接收/发送邮件,报错为:存储区已达到最大大小     解决办法: 解决思路:新建一个数据文件来接收发送邮件   具体操作: 文件-账户配置-数据文件-新建(更 ...

  8. Java日期时间API系列18-----Jdk8中java.time包中的新的日期时间API类,java日期计算5,其他常用日期计算,星期计算,闰年计算等

    通过Java日期时间API系列8-----Jdk8中java.time包中的新的日期时间API类的LocalDate源码分析中可以看出,java8中的方法特别丰富,一些常用的计算如星期计算,闰年计算等 ...

  9. webpack配置 alias用于方便引用文件

    .markdown-body { line-height: 1.75; font-weight: 400; font-size: 16px; overflow-x: hidden; color: rg ...

  10. Paths和Files

    Paths 类 Paths 类主要用于操作文件和目录路径.它提供了一些静态方法,用于创建java.nio.file.Path实例,代表文件系统中的路径. // 创建一个Path实例,表示当前目录下的一 ...