Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting a new record via OleDbCommand
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00693070
Message ID:
00693107
Views:
20
>I have found KB article on MSDN that has some known issues.
>
>http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q157767&
>
>Are you using any unsupported commands in the Trigger? Can you post your trigger code?
>
>

It's the standard NewID() function that most people use. I didn't see any unsupported functions in it (and I'm using the OLE-DB provider in VFP 7, not ODBC).
#DEFINE DB_SRCLOCALVIEW		1

FUNCTION NewID(tcAlias)
  *-- Special thanks to Steve Sawyer for his work on allowing
  *-- both character and numeric keys to work with this routine.
  LOCAL lcAlias, ;
        luID, ;
        lnOldReprocess, ;
        lnOldArea

  lnOldArea = SELECT()
  
  IF PARAMETERS() < 1
    lcAlias = ALIAS()
    IF CURSORGETPROP("SOURCETYPE") = DB_SRCLOCALVIEW
      *-- Attempt to get base table
      lcAlias = UPPER(CURSORGETPROP("TABLES"))
      lcAlias = SUBSTR(lcAlias, AT("!", lcAlias) + 1)
	  *-------------------------------------------------
	  *-- If NewID() is specified as the default value 
	  *-- in a view field rather than a table, there may 
	  *-- be multiple database references to truncate
	  *-------------------------------------------------
      IF AT(",", lcAlias) > 0
      	lcAlias = SUBSTR(lcAlias, 1, AT(",", lcAlias) - 1)
      ENDIF
    ENDIF
  ELSE
    lcAlias = UPPER(tcAlias)
  ENDIF
        
  luID = ""
  lnOldReprocess = SET('REPROCESS')
  
  *-- Lock until user presses Esc
  SET REPROCESS TO AUTOMATIC

  IF !USED("websecid")
    USE websecid IN 0
  ENDIF
  SELECT websecid
      
  IF SEEK(lcAlias, "websecid", "keyname")
    IF RLOCK()
      luID = IIF(websecid.type = 'C', websecid.value, VAL(websecid.value))
      REPLACE websecid.value WITH EVAL(websecid.incrementprocedure)
      UNLOCK
    ENDIF
  ENDIF
    
  SELECT (lnOldArea)
  SET REPROCESS TO lnOldReprocess
  
  IF websecid.Type = 'C'
  	RETURN TRIM(luID)
  ELSE
  	RETURN luID
  ENDIF
    
ENDFUNC

FUNCTION IncrementBase10(tcValue)
	*-- Increments a base 10 number. This function assumes that
	*-- the length of tcValue represents the maximum number of 
	*-- possible digits for this base 10 number.
	LOCAL lnStringLength
	lnStringLength = LEN(tcValue)
	RETURN PADL(RIGHT(ALLT(STR(VAL(tcValue) + 1)), lnStringLength), lnStringLength)
ENDFUNC
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform