用PB生成GUID解决主键重复
编一个全局函数如下:
//---------------------------------------------
//Function f_get_GUID//得到全球唯一码
//Argument: <ref string> of_guid //全球唯一码
//Return: [None]
//----------------------------------------------
oleObject PBObject
long ll_result
PBObject = CREATE oleObject
ll_result = PBObject.ConnectToNewObject("PowerBuilder.Application")
IF ll_result < 0 THEN
messagebox(gs_message,"连接失败:与PowerBuilder.Application连接出错!")
return
ELSE
ll_result = PBObject.GenerateGUID(REF of_guid)
END IF
IF ll_result < 0 THEN
messagebox(gs_message,"生成GUID失败:不能获得GUID!")
return
END IF
of_guid = mid(of_guid,2,len(of_guid) - 2)
//End of Fuction