可能需要一种错误捕获方式 [英] possibly need a way of error trapping

查看:51
本文介绍了可能需要一种错误捕获方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这应该在这里还是在Access论坛中,但是这里是


我有一个VB6程序,它使用访问数据库记录竞争对手和分数来自一个竞争对手这很好用,我会在每次更新后调用这个数据库(A)


数据库(A)将自己复制到预设位置,我将其称为数据库(B)


到目前为止一切都很好


在远程位置还有另一台计算机带有主程序的减少版本,只允许竞争对手查看结果这个使用我将调用的数据库(C)


数据库(C)是数据库(B)的副本,每次返回主选择屏幕时它也会更新


99%的时间一切正常,直到数据库(C)尝试复制(B)只是在点(A)复制到(B)和程序上远程计算机崩溃


现在问题


做任何人k现在有一种方法可以捕获由(C)尝试复制数据库时的错误(B)当它被锁定时(A)更新(B)

所有我需要的是远程计算机跳过更新,下次再试一次


我希望这是有道理的,有人可以帮助我尽可能简单地解决这个烦恼

非常感谢提前


问候Rob

解决方案

稍微切线,你或许可以通过两个阶段进行A-> B复制来降低发生这种情况的可能性。

  1. 将A复制到B'的位置具有不同的名称
  2. 删除B并重命名副本。

最终结果是一样的,但是你花在B上的时间少得多。


嗯。 ..


我想我可能已经错过了问题的重点。我假设你在谈论将数据库文件复制到另一个位置。您实际上是指将记录从一个数据库复制到另一个数据库吗?



...每次更新后都会生成数据库(A)自行复制到我预设的位置,我将其称为数据库(B)...



这很简单;创建一个名为(something.lock)的锁文件。没有关于锁文件的魔力。它只是一个空文件。

在(A)更新(B)之前,它会创建一个锁定文件。 (C)将跳过从(B)更新直到锁定文件被删除。

当(A)完成更新(B)时,它删除锁定文件。因此(C)可以继续从(B)更新数据。



这只是创建一个名为(something.lock)的锁定文件。没有关于锁文件的魔力。它只是一个空文件。

在(A)更新(B)之前,它会创建一个锁定文件。 (C)将从(B)跳过更新直到锁定文件被删除。

当(A)完全更新(B)时,它删除锁定文件。因此(C)可以继续从(B)更新数据。



这就是找到锁定文件时崩溃程序的问题。

我需要找到一种方法让它在找到锁定文件时跳过更新


非常感谢到目前为止的回复,让他们来吧


I don''t know if this should be here or in an Access forum but here goes

I have a VB6 program that uses an access database to record competitors and scores from a competion this works fine and i will call this database (A)

after each update is made database (A) copies itself to a preset location which I will call database (B)

so far everything is fine

at a remote location there is another computer with a cut down version of the main program which only allows competitors to view the results this uses a database I will call (C)

database (C) is a copy of database (B) and it also updates every time you return to the main selection screen

everything works fine for 99% of the time until database (C) attempts to copy (B) just at the point (A) is copying to (B) and the program on the remote computer crashes

and now to the question

does anyone know of a way of trapping the error caused by (C) trying to copy the database (B) when it is locked by (A) updating (B)
All I would require is for the remote computer to skip the update and just try again next time

I hope this makes sense and someone may be able to help me get past this annoyance as simply as possible

Many thank in advance

Regards Rob

解决方案

On a slight tangent, you might be able to reduce the chances of it happening by doing the A->B copy in two stages.

  1. Copy A to B''s location with a different name
  2. Delete B and rename the copy.

End result is the same, but you spend much less time with B unavailable.

Um...

I think I may have missed the point of the question. I was assuming you were talking about copying the database files to another location. Were you actually referring to copying records from one database to another?


... after each update is made database (A) copies itself to a preset location which I will call database (B) ...

This is simple; create a lock file called (something.lock). No magic about the lock file. It''s simply an empty file.
Before (A) updating (B), it creates a lock file. (C) will skip update from (B) till lock file is deleted.
When (A) completes updating (B), it delete lock file. So (C) can continue update data from (B).


This is simply create a lock file called (something.lock). No magic about the lock file. It simply an empty file.
Before (A) updating (B), it create an lock file. (C) will skip update from (B) till lock file is deleted.
When (A) completelly update (B), it delete lock file. So (C) can continue update data from (B).

Thats exactly the problem when it finds the lock file it crashes the program.
I need to find a way for it to skip the update when it finds the lockfile

Many thanks for the replies so far, keep them coming


这篇关于可能需要一种错误捕获方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆