Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the best ODBC way to go?
Message
De
08/11/2001 17:41:52
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00579252
Message ID:
00579431
Vues:
45
Interesting, but doesn't it adds a lot of overhead? I mean doesn't it make your app slower?


Luis


>I don't have to set any properties. I have a generic method that create the INSERT, UPDATE or DELETE SQL string based on the structure of the cursor. I then use SPT to sen the SQL back to the server. I have simplified this by having a standard PK field in all my tables named KeyID which is an integer field [a NUMBER(8) data type column in Oracle].
>
>This is quite simple when using a FOR loop based on FCOUNT(), and FIELD(lnI). I just check the data type for each field in order to create the VALUES part of the SQL string.
>
>Here is an example of how I generate an INSERT - SQL string for Oracle:
>   PROTECTED PROCEDURE GenerateSQLInsert
>      LPARAMETERS tcLocalCursor, tcRemoteTable
>      LOCAL lcSQL, lnI, lcValues, lcString
>      lcSQL = 'insert into ' + tcRemoteTable + ' ('
>      lcValues = ''
>      FOR lnI = 1 TO FCOUNT(tcLocalCursor)
>         IF lnI > 1
>            lcSQL = lcSQL + ', '
>            lcValues = lcValues + ', '
>         ENDIF
>         lcSQL = lcSQL + FIELD(lnI)
>         DO CASE
>            CASE TYPE(FIELD(lnI)) = 'N'
>               IF ISNULL(EVALUATE(FIELD(lnI)))
>                  lcString = '0'
>               ELSE
>                  lcString = TRANSFORM(EVALUATE(FIELD(lnI)))
>               ENDIF
>               lcValues = lcValues + lcString
>            CASE TYPE(FIELD(lnI)) = 'T'
>               IF ISNULL(EVALUATE(FIELD(lnI)))
>                  lcString = "''"
>               ELSE
>                  lcString = "TO_DATE('" + TRANSFORM(EVALUATE(FIELD(lnI))) ;
>                         + "', 'MM/DD/YYYY HH24:MI:SS')"
>               ENDIF
>               lcValues = lcValues + lcString
>            OTHERWISE  && CASE TYPE(FIELD(lnI)) = "C"
>               IF ISNULL(EVALUATE(FIELD(lnI)))
>                  lcString = "''"
>               ELSE
>                  lcString = "'" + STRTRAN(ALLTRIM(EVALUATE(FIELD(lnI))), "'", "") + "'"
>               ENDIF
>               lcValues = lcValues + lcString
>         ENDCASE
>      ENDFOR
>      lcSQL = lcSQL + ') values (' + lcValues + ')'
>      RETURN lcSQL
>   ENDPROC
>
>
>>Thanks, but Can anyone give the advantages, disadvantages of using user DSN, system DSN, file DSN, or a connection String?
>>
>>As for your reply, how do you manage to update your tables? Do you have to set a looot of properties for each view and its fields?
>>
>>TIA
>>
>>
>>>I have an ODBC_DSN class in the UT Downloads that has examples. I use Oracle, but the concept is the same. I connect using SQLStringConnect() then use SPT. I still have apps using Remote Views, but I am moving to using SPT almost exclusively.
>>>
>>>>I have an application that uses SQL Server 7 as a back end. So, I created a System DSN. Then I created a connection in my app's DBC that refers to that DSN. But the connection designer has an option to specify a Connection string. Would someone tell me what is the best way to connect to SQL Server? Through a user DSN, system DSN, file DSN, or a connection String???
>>>>
>>>>Another thing is (in case I use a DSN) How can I let the App setup create a DSN so I don't have to create and configure it by myself.???
>>>>
>>>>TIA
>>>>
>>>>
>>>>Luis
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform