AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > PowerBuilder

用PB生成GUID解决主键重复

51自学网 http://www.wanshiok.com

  编一个全局函数如下:
  //---------------------------------------------
  //Function f_get_GUID//得到全球唯一码
  //Argument: <ref string> of_guid //全球唯一码
  //Return: [None]
  //Create by 泥草鞋 2004-03-10
  //----------------------------------------------
  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

<

 

 

 
上一篇:用PB编写邮件应用程序(4)  下一篇:PB动态报表的实现