Либо. Как можно залезть в exe’шник и в fox’овском тексте поменять одну строку.
С уважением, Александр
Re: ReFox->FoxPro6->SELECT->Alias not found
Владимир Максимов
Сообщений: 13911 Откуда: Москва
Дата: 17.08.09 16:07:50
Поэтому сообщение «alias not found» вовсе не означает, что не найден файл. Это всего-лишь означает, что не найдена рабочая область с открытой таблицей, которой присвоен alias с указанным именем.
Как правило, подобное происходит, если в рабочей области, где ранее была открыта таблица, открывают другую таблицу. С другим alias-ом. Естесственно, что старая таблица при этом закрывается. И ее alias теряется.
Обычно это присходит при адресации к рабочим областям по номерам без анализа факта «занятости» указанной рабочей области другой таблицей. Т.е. код вида
Потенциально опасен тем, что может закрыть ранее открытую таблицу в 1 рабочей области. Более корректным является синтаксис вида
Рабочая область с номером 0 интерпретируется как «первая свободная» рабочая область.
Но, естесственно, весь код должен быть построена на переходе к нужным рабочим областям не по номерам, а по алиасам.
Re: ReFox->FoxPro6->SELECT->Alias not found
axiv Автор
Сообщений: 3
Дата: 17.08.09 16:15:35
Re: ReFox->FoxPro6->SELECT->Alias not found
axiv Автор
Сообщений: 3
Дата: 17.08.09 16:20:19
Re: ReFox->FoxPro6->SELECT->Alias not found
Владимир Максимов
Сообщений: 13911 Откуда: Москва
Дата: 17.08.09 16:28:05
Нормально. Так и должно быть. Эта команда переключается в указанную рабочую область. Ну, это примерно «переводится» так: а теперь будем работать в рабочей области
Боролся с чем? Открыть таблицу надо только один раз. Далее просто переключаться в рабочую область, где эта таблица открыта. Вы что, вместо переключения открывали таблицу снова?
А каким боком к этому коду относится USE?
Если вы вообще программировали хоть в каком-нибудь языке программирования, то принцип работы с файлами везде одинаковый.
1) Файл открывается и открытому файлу присваивается некий идентификатор 2) Выполняется работа с файлом, причем обращение к нему идет по этому идентификатору 3) По окончании работы с файлом он закрывается.
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
I use vfp9 sp2 and win xp.
When I leave a form called Houses and go into another form where the load procedure has the code:
** close all open forms FOR x = 1 TO _screen.FormCount _screen.Forms[_screen.Formcount].Release() NEXT x
I get error 13 above.
The Houses form uses a view called VIEW_HOUSE2, but so what?
Why do I get the error? How do I fix it?
The line of code that creates the error is reported to be:
UPDATE gis_data!students SET houseid=view_house2.houseid WHERE houseid=OLDVAL(‘houseid’,’view_house2′) AND > But, I can not find that code anywhere!
Answers
I guess the simplest way to solve the problem for now is to add
use in select(‘view_house2’)
in the Houses form destroy method.
Are you using Data Environment in that form?
Also, I still think that the code you’re listed came from the database. Can you get GoFish and search for that offending code?
All replies
Do you have some code in Release method of the closed form(s)?
It seems the view is closed earlier than the control which still uses it is released.
I tried to edit the original post, but unsuccessfully, so here goes:
The line of code that creates the error is reported to be:
UPDATE gis_data!students SET houseid=view_house2.houseid WHERE houseid=OLDVAL(‘houseid’,’view_house2′) AND > But, I can not find that code anywhere!
Why do you need to call this method in the Load method of your form?
Also, the code above may come from a trigger. If you use DBC, can you check if you have triggers implemented?
I call the method as I want only the current form open.
I am afraid I don;t know what DBC and triggers mean.
Are you using a database or free tables?
A bit more robust close all forms method:
I tried to edit the original post, but unsuccessfully, so here goes:
The line of code that creates the error is reported to be:
UPDATE gis_data!students SET houseid=view_house2.houseid WHERE houseid=OLDVAL(‘houseid’,’view_house2′) AND > But, I can not find that code anywhere!
VFP is attempting to update the table on which is the view created. You should find the code in database:
and the database code should appear.
I am using a database.
Thank you for the alternative code. I will try it.
When I try the three instructions a window comes up with title «Stores Procedures for Gis_data».
The window is empty. So, no stored triggers.
I would guess you are using some framework or VCX classes at least. The update command could be generated based on the view structure. In such case it is not so easy to find the right place. So please check your VCX classes.
You should also look at the code which is executed by the form itself when it is closed and call exactly same methods from your «close all forms» code.
In houses.destroy (that was empty) I put:
IF USED(‘view_house2’) MESSAGEBOX(‘used’) ELSE MESSAGEBOX(‘not used’) ENDIF
When I ran the program and went to houses and then went to for B it said: «not used»
Then in form B’s load method I put:
IF USED(‘view_house2’) MESSAGEBOX(‘used’) ELSE MESSAGEBOX(‘not used’) ENDIF
** close all open forms FOR x = 1 TO _screen.FormCount _screen.Forms[_screen.Formcount].Release() NEXT x
When I ran it, first going to houses and then to B it said «not used», «used» and then it crashed on the release instruction complaining that alias view_house2 could not be found.
As far as I know I am not using any framework or VCX classes. To be honest, I don´t know what either means.
In form B´s load I added ‘set step on’:
** close all open forms FOR x = 1 TO _screen.FormCount SET STEP on _screen.Forms[_screen.Formcount].Release() NEXT x
I then called up form Houses followed by form B. This happened when I stepped through the code with F8:
_screen.FormCount = 2 all the time, but it drops to 1 just after houses.unload finishes and the error is reported.
Цитата alpap: возможную необходимость кавычек » вообще говоря имена машин без пробелов, если вы об этом. Меня тильда удивила.
Iska, код тот же на данный момент:
без пустых строк, пробелов, иных знаков.
ps, а простой перенос строки в пределах одной команды в батнике возможен вообще? Разве тогда выполнение не ограничивается первой строкой? Как я понимаю, только с добавлением символа каретки, иначе всё, что с новой строки идёт, должно восприниматься как новая команда. Хоть в логе перед выбросом ошибки всю группу цитировало, но не может в этом ошибка крыться?
Thanks. We have received your request and will respond promptly.
Come Join Us!
Posting Guidelines
Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Alias Not Found
Alias Not Found
Alias Not Found
I have an application with a number of forms. The system admin has a form to select the data and software location. That is saved to a table and is accessed when the application starts. At start up time a list of public variables is built concatenting the data location and the table names (this app uses old style DB III tables).
In the data environment of each form I have a cursor for each table to be used. In the «Before Open Tables» Event of the Data Environment I set the CursorSource for each cursor to the appropriate variable with the fully qualified name for the table. If I stop the form in debug the value is set correctly. I then let the tables open automatically and proceed with my processing.
This always worked in VFP 3, 5, 6 and 7. Now in VFP 8 I get a «Alias Not Found» message for the first cursor and then all works fine. That includes all the processing related to the fact that those cursor(s) are supposed to be open. Also, if I open a second form I do not get the error message. The error message does not occur again until I close the app and restart it.
What is different about VFP 8?
Any help would be greatly appreciated. Thanks
RE: Alias Not Found
-Dave Summers- Even more Fox stuff at: http://www.davesummers.net/foxprolinks.htm
RE: Alias Not Found
Thanks Dave. I’ve been fighting with it some more since I wrote the original thread. It seems to be a specific table that is the problem. If I take that table/cursor out the other 3 work fine. If I remove it totally and put a USE («filename») IN 0 ALIAS CMSDbf just before I begin processing I get the same message. That message being «Alias ‘CMS’ is not found». This occurs at the USE statement yet it opens the table with the correct alias and the processing works fine once you click OK to the message.
The table/file opens in VFP 8 (the ENGINEBEHAVIOR did not help). I have tried hard coding the filename (for testing), using the variable and just typing it in the command window. Nothing works for that one table.
I’d settled for a way to stop the message from appearing at this time. Can’t get that to work either.
RE: Alias Not Found
I am a little confused. Alias ‘CMS’ is not found indicates that you are referencing an alias that does not exist in the current datasession. such as you would get if you ran:
SELECT «CMS» *or* REPLACE cms.fld WITH «» IN cms
from the command window when no such work area contains a table/cursor opened under the alias «CMS»
The problem is that there is no table opened under the alias «CMS» though it is being referenced somewhere in the application. Why you don’t get this same behavior in VFP7 and below is a mystery since you seem to have ruled out the only possible cause I could think of that was given by Dave. Perhaps there are differences between these different versions of your app that you are not fully privy to?
You’ll need to provide more information and code for this to be properly diagnosed here, it is not an undocumented bug I am quite sure. VFP is telling you exactly what is going on via that error message. «CMS» whatever table/cursor that is an alias for is not opened in the current datasession at the point at which a yet discovered line of code or property reference in a form/control/object/report is interpretted by VFP runtime. Find exactly what is happening when you get the error and you’ll know what is happening.
RE: Alias Not Found
Oh Craig you are worth your weight in gold, now if I can only get the client to pay you for it.
Yes it did truely fail at the USE statement.
Here’s the deal. These tables that I am accessing are from a package call MOM (Mail Order Manager) and the client just upgraded to the newest version. That meant a few new fields, field size changes and of course new indices. So I was testing my old reports against the new tables.
Your suggestions about triggers did it. There was a new index in that table that had a reference to CMS. instead of just the column name. I took out the reference to CMS and it worked fine.
Thank you, I’ve spent the whole day being frustated. You are the best.
RE: Alias Not Found
Glad to hear you were able to solve that annoying problem. I absolutely hate it when that sort of thing happens and a perfectly good day is wasted.
I am of the mind that all this compartmentalization in most programming languages is not necessarily a good thing. The organization is fine, but when there are so many doors and drawers, one is not always sure which one to look in when trying to find something (take a report throwing a syntax error when there are hundreds of controls on it. double-click them one at a time or at the very best, open the report as a table. heck!). The code reference tool was a great addition to VFP 8 and I hope that MS will continue to add to these types of search utilities in their programming languages. and how about an error message for a report that tells us which one of the fields on the report is throwing the error while they are at it.
Red Flag Submitted
Thank you for helping keep Tek-Tips Forums free from inappropriate posts. The Tek-Tips staff will check this out and take appropriate action.
Reply To This Thread
Posting in the Tek-Tips forums is a member-only feature.
Click Here to join Tek-Tips and talk with other members! Already a Member? Login