Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Database is using table ?
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01416848
Message ID:
01416849
Views:
35
Do you set SET EXCLUSIVE OFF at the top of your code?

>I used "select 0" for many years in code below with free tables
>
>Now I added my tables to a database and get error "table in use" if I run the code
>
>if I remove "select 0" problem does not happen
>
>What code can I write instead of select 0 ?
>(this is a program, not a forma method)
>
>***********************************************
>
>
>conta_erro = 0
>N_ERRO = 0
>
>
>* set excl on
>
>STORE SYS(5) + curdir() + "dados" TO MyIntoPath && diretorio atual
>
>lcAppendIntoPath = ADDBS(myIntoPath)
>lnNumTables = ADIR(aTables,lcAppendIntoPath+"*.dbf")
>
>*CLOSE DATA
>
>SELECT 0 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Here is the problem
>
>FOR I = 1 TO lnNumTables
>
>*= MESSAGEBOX (lcAppendIntoPath+aTables[i,1])
>
> TRY
>
>*SELECT * FROM (lcAppendIntoPath+aTables[i,1]) INTO CURSOR TMP1
>*use
>
>
>USE (lcAppendIntoPath+aTables[i,1])
>
>
> CATCH TO oErr
> n_erro = oErr.ErrorNo
>
>= MESSAGEBOX (lcAppendIntoPath+aTables[i,1] + " " + STR( N_ERRO))
>
>IF N_ERRO # 0
>conta_erro = conta_erro + 1 && se tiver erro vai acumulando pois passa aqui várias vezes
>
>
>ENDIF
>
>
>DO CASE
>
>
> CASE n_erro = 15
>
> = MESSAGEBOX ("TABELA CORROMPIDA ERR0 15: " )
>
>
> CASE n_erro = 41
>
> = MESSAGEBOX ("TABELA SEM FTP: ")
>
>
> CASE n_erro = 1707 && corrompida, fpt, sem CDX
>
> = MESSAGEBOX ("TABELA SEM CDX: ")
>
>
> CASE n_erro = 114 && corrompida, fpt, sem CDX
>
> = MESSAGEBOX ("TABELA NÃO CONFERE COM O CDX: " )
>
>
> CASE n_erro = 2091 && corrompida, fpt, sem CDX
>
> = MESSAGEBOX ("TABELA CORROMPIDA ERRO 2091 :" )
>
>
> THISFORM.Refresh
>
> OTHERWISE
>
>
>ENDCASE
>
>
>
>ENDTRY
> ENDFOR
>
> CLOSE DATABASES
>
>
> if conta_erro # 0 && SE TIVER ERROS
>
> DO case
>
>
> CASE n_erro = 15 OR n_erro = 41 OR n_erro = 1707 OR n_erro = 114 OR n_erro = 2091
>
> = MESSAGEBOX("Os dados estao corrompidos. Recomendamos enviar a pasta dados para ser analisada. Ou restaure do backup")
>
> other
>
> = MESSAGEBOX ("Erro: " + STR (N_ERRO)+ " Se houver outra instância do software aberta na mesma máquina ou em rede, vá até o menu principal do outro programa que está aberto e clique em opçoes e depois em fechar arquivos.Se o problema persistir informe o erro ao nosso suporte ")
>
> SET EXCLUSIVE OFF
>
>
>
> other
>
>
>
> ENDCASE
>
> ELSE
>
>
> ENDIF
>
>
>SET EXCLUSIVE OFF
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform