SQL数据库断线重连脚本例程:
方式1:
long Result;
Result=SQLDelete( DeviceID, "DATA", "");
SQLInsert( DeviceID, "DATA", "DATA" );
if(Result!=0)
{
SQLDisconnect( DeviceID);
SQLConnect( DeviceID, "dsn=root;uid=;pwd=");
SQLDelete( DeviceID, "DATA", "");
SQLInsert( DeviceID, "DATA", "DATA" );
}
方式2:
long ResultCode;
ResultCode=SQLDelete( DeviceID, "DATA", "");
SQLErrorMsg( ResultCode,\localuf);
//其中\localuf必须为数据词典中内存字符串,ResultCode输出的是数字代码,\localuf输出的是文本原因。
SQLInsert( DeviceID, "DATA", "DATA");
if(ResultCode!=0)
{
SQLDisconnect( DeviceID);
SQLConnect( DeviceID, "dsn=root;uid=;pwd=");
SQLDelete( DeviceID, "DATA", "");
SQLInsert( DeviceID, "DATA", "DATA");
}