Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Pass Through Problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01063586
Message ID:
01063684
Vues:
12
Ok, here's the completed, working function.

Thanks everyone
PROCEDURE HandleError(sAppName AS String, iErrNo AS Integer,;
                      sErrMessage AS String, sLineOfCode AS String,;
	              sProgram AS String, iLineNo AS int, sStack AS String)
	
  LOCAL iRetVal, sDateTime, sErrNo, sLineNo, sUserId, sMemory, sStatus
  LOCAL sSqlCommand
  iRetVal = TRUE

  WITH This
		
    IF ._Setup()

      tDateTime = DATETIME()
      sUserId   = UPPER(ALLTRIM(SUBSTR(SYS(0), AT("#", SYS(0))+1)))

      CREATE CURSOR Temp1;
        (EntryDT 	DateTime,;
	 ErrNo 		Numeric (4,0),;
         LineNo		Numeric (5,0),;
         ErrMsg		Character(50),;
	 CodeLine Character(50),;
         Program  Character(50),;
	 UserId		Character(20),;
	 AppName	Character(20),;
	 Notified	Numeric(1))

      INSERT INTO Temp1;
          (EntryDT, ErrNo, LineNo, ErrMsg, CodeLine, Program, UserId, AppName, Notified);
        VALUES;
	  (tDateTime, iErrNo, iLineNo, sErrMessage, sLineOfCode, sProgram, sUserId, 
            sAppName, 0)

      TEXT TO sSqlCommand NOSHOW
				
         insert into syserrors
	   (datetime, error, line, message, codeline, program, userid, appname, Notified)
          values
           (?Temp1.EntryDT, ?Temp1.ErrNo, ?Temp1.LineNo, ?Temp1.ErrMsg, ?Temp1.CodeLine,
             ?Temp1.Program, ?Temp1.UserId, ?Temp1.AppName, ?Temp1.Notified)

      ENDTEXT
				
      ** Run the insert command
      ._oSQLProcs.SQLCommand(sSqlCommand)

      USE IN Temp1
      ERASE Temp1.dbf

      ** Check for and handle any errors that occured
      ._CheckForSQLError()
				              
    ENDIF
		
  ENDWITH
	
RETURN
	
	ENDPROC
>>Not sure what you mean by
>>"You might create an updatable SPT to fill in the fields and update."
>>
>>Can you elaborate on this a bit more please?
>
>See How to make SQL Pass-Through cursor updatable FAQ #8153
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform