Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems with TYPE() VARTYPE()
Message
De
11/08/2004 10:55:16
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00932205
Message ID:
00932351
Vues:
9
Are you sure that, as far as the COM object is concerned, the table referred to by ExportFileName is open? You can test for that with USED(exportFileName) within the COM object.

>I am not sure that the code will help you as it is meta data driven. I would have to send you all the tables too (which are ALL in MSSQL) in order fo you to have it run 100%.
>
>My main issue is I have a program that works fine as a PRG but when I convert it over to a COM object the TYPE() command no longer returns any value except "U". In the PRG it always returns the correct value.
>
>
>Here is the code !
>
>************************************************************************************************
>PROCEDURE ProcessFoxPro()
>
>* Store the Table name and Location into variables which we will use later on.
>ExportFileLocation = ADDBS(ALLTRIM(Systems2Process.ExportDataLocation))
>ExportFileName = ALLTRIM(Systems2Process.ExportDataName)
>
>FieldList = ""
>ValuesList = " VALUES("
>RunCommand = "INSERT INTO " + ExportFileLocation + ExportFileName + "("
>
>* STRTOFILE("Started ProcessFoxPro", "c:\junk\InsertCommand.txt", 1)
>
>This.GetSystemLayoutLocal(Systems2Process.SystemIdPk)
>
>SELECT SystemLayout
>
>SCAN
>
>  FieldList = FieldList + ALLTRIM(SystemLayout.SystemFieldName) + ","
>
>  Field2Process = ALLTRIM("Data2Add." + MasterFieldName)
>  TempVal = TRANSFORM(&Field2Process)
>
>  InsertFieldName = ExportFileName + "." + ALLTRIM(SystemLayout.SystemFieldName)
>
>  * This is the line that does not return the correct value.
>  InsertFieldType = TYPE(InsertFieldName)
>
>  STRTOFILE(InsertFieldName  + SPACE(5) + InsertFieldType + CHR(13), "c:\junk\InsertCommand.txt", 1)
>
>  DO CASE
>    CASE InsertFieldType = "D"
>      TempVal = "{" + TempVal + "}"
>    CASE InsertFieldType = "T"
>      TempVal = "{" + TempVal + "}"
>    CASE InsertFieldType = "C"
>      TempVal = "'" + ALLTRIM(TempVal) + "'"
>    CASE InsertFieldType = "M"
>      TempVal = "'" + ALLTRIM(TempVal) + "'"
>    CASE InsertFieldType = "N"
>      TempVal = TempVal
>    OTHERWISE
>      TempVal = "'" + ALLTRIM(TempVal) + "'"
>  ENDCASE
>
>  ValuesList = ValuesList + TempVal + ","
>
>ENDSCAN
>
>* Strip the ending ; off the pieces of the insert command and then add the necessary ) instead.
>FieldList = SUBSTR(FieldList, 1, LEN(FieldList) -1) + ")"
>ValuesList = SUBSTR(ValuesList, 1, LEN(ValuesList) - 1) + ")"
>
>* Build the FINAL Insert command so that we can return it.
>RunCommand = RunCommand + FieldList + ValuesList
>
>RETURN (RunCommand)
Steve Gibson
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform