Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Auto Increasement Procedure
Message
De
21/03/2003 02:34:59
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
20/03/2003 22:04:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00768430
Message ID:
00768471
Vues:
19
This message has been marked as the solution to the initial question of the thread.
>Hi There,
>
>I'm running a website on a VFP7 database which uses a automated VFP Procedure every time a record is added to the database. This works as expects on my local environment but when upload I receive a error every time I try to add a record. I am receiving this error because the Procedure is not being fired.
>
>I'm am on a shared server. Could this be because they don't have the latest version of MDAC?
>
>Here is the VFP procedure. Just to show you that all it does is auto increase the number in the ID fields in Tables.
>
>FUNCTION NewID(tcAlias)
>  LOCAL lcAlias, ;
>        lnID, ;
>        lcOldReprocess, ;
>        lnOldArea, ;
>        llUsed
>
>  lnOldArea = SELECT()
>
>  IF PCOUNT() < 1
>    lcAlias = UPPER(ALIAS())
>  ELSE
>    lcAlias = UPPER(tcAlias)
>  ENDIF
>
>  lnID = 0
>  lcOldReprocess = SET('REPROCESS')
>
>  *-- Lock until user presses Esc
>  SET REPROCESS TO AUTOMATIC
>
>  IF !USED("SETUP")
>    llUsed = .F.
>    USE reliez!setup IN 0
>  ELSE
>    llUsed = .T.
>  ENDIF
>  SELECT setup
>  SET ORDER TO TableName
>
>  SEEK lcAlias
>  IF FOUND()
>    IF RLOCK()
>      lnID = setup.value + 1
>      REPLACE setup.value WITH lnID
>      UNLOCK
>    ENDIF
>  ENDIF
>
>  IF !llUsed
>     USE
>  ENDIF
>
>  SELECT (lnOldArea)
>  SET REPROCESS TO lcOldReprocess
>
>  RETURN lnID
>ENDFUNC
>
>
>
>Kind Regards,
>
>Tarran Walker

Tarran,
Via remote inserts stored procs are not fired automatically. You should call it yourself to get the newid and send it too. ie :

set oRs = oConn.Execute("NewID('myTable')")

Then you can use oRS.Fields(0).Value.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform