Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
OPEN DATABASE 'MYDATABASE'
IF INDBC('myconnect','CONNECTION')
DELETE CONNECTION myconnect
ENDIF
CREATE CONNECTION myconnect DATASOURCE 'MYDATA' USERID 'MYUSER' PASSWORD 'MYPASSWORD'
IF INDBC('myview1','View')
DELETE VIEW myview1
ENDIF
Here is the code sample you requested. I hope it is of some help. Thanks
IF !USED('MYTABLE')
USE mytable SHARED IN 0
ENDIF
CREATE SQL VIEW myview1;
CONNECTION myconnect AS ;
SELECT *;
FROM pers
=DBSETPROP('myview1.PERS_NO','Field','KeyField',.T.)
=DBSETPROP('myview1','View','SendUpdates',.T.)
IF !USED('MYVIEW1')
SELECT 0
USE myview1
ENDIF
SELECT MYTABLE
GO TOP
DO WHILE !EOF()
SELECT myview1
* 1st time through is ok.
GO TOP && When returning here it crashes.... Says the connection is still busy
LOCATE FOR UPPER(ALLTRIM(MYTABLE.first_name)) == UPPER(ALLTRIM(myview1.first_name)) AND ;
UPPER(ALLTRIM(MYTABLE.last_name)) == UPPER(ALLTRIM(myview1.last_name))
IF FOUND()
cntr1 = cntr1 + 1
* This wait helps slow it down. but it takes forever to finnish
wait window ALLTRIM(STR(cntr1)) timeout 1
REPLACE myview1.title WITH MYTABLE.title
*!* TABLEUPDATE(.T., .F.,'myview1')
ENDIF
SELECT MYTABLE
SKIP
ENDDO
* Putting this here or above does not matter for the crash
TABLEUPDATE(.T., .F.,'myview1')
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement