Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting a new record via OleDbCommand
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00693070
Message ID:
00693115
Vues:
22
It is very strange. This should not fail unless there are some issues accessing SP using OLE DB provider. To prove this, can you just put
RETURN 9999
as the first line of NewId() SP?

>>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
>
- Jayesh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform