- Remove From My Forums
-
Question
-
Hi all,
I have a foxpro command written in vfp application to update branch-wise details in a csv files as follows
copy to &BRC get the error ‘Command contains unrecognized phrase/keyword’Can anybody have an idea of occuring this error? This might happen under what circumstances?
Regards
PUBL BRC
CLOSE ALL
SELE B
USE LLSELE A
USE BR
GO TOPdo whil !eof() and !empt(brcd)
SELE B
COPY TO LTOP FOR A->brcd=BRCD
SELE C
USE LTOP
INDEX ON -BALANCE TO B
COPY TO LLTOP
USE LLTOPBRC=»TOPBORROWERS-«+ALLT(BRNAME)
copy to &BRC FIEL BRCD,BRNAME,CIF,NAME,BALANCE,ADD1,ADD2,ADD3,ADD4,PIN,PHONE,PHONE1,MOBILE for recno()<=m.no TYPE csv
SELE A
SKIPenddo
Answers
-
Hi,
Try
suppose you have two tables table1 ‘LL’ and table2 ‘BR’
IF !USED(‘LL’)
USE LL IN 0
ENDIFIF !USED(‘BR’)
USE BR IN 0
ENDIF
SELECT BRSELECT BRCD,BRNAME,CIF,NAME,BALANCE,ADD1,ADD2,ADD3,ADD4,PIN,PHONE,PHONE1,MOBILE ;
TOP 100 ;
FROM BR WHERE for recno()<=m.no INTO CURSOR Topborrowers NOFILTER READWRITE ORDER BY BalancelcFile = «Topborrowers»+ALLTRIM(Br.BrName)
SELECT Topborrowers
COPY TO (m.lcFile) TYPE CSV** However please note carefully:
** the condition recno()<=m.no is no good, never use the recno() in such a way, use either the ID
** or if you want, I presume only a limited number of reccords, the TOP parameter.
Regards,Koen
-
Marked as answer by
Tuesday, December 20, 2016 6:19 AM
-
Marked as answer by
-
Makes me wonder whether this error will ever get extinct.
Think about a file name with a space in it or it’s path. The part up to the first space is seen as file name and then the rest of the file name is parsed as command option(s) and leads to unrecognized phrase/keyword error in most any case. Notice: ALLTRIM()
only removes leading and trailing spaces from the brname field, not inner spaces.copy to (m.BRC) FIELDS …
With this syntax (name expression = expression in brackets in a place a command expects a file name) is working, even in case a space is
in the name. Use that instead of macro substitution wherever you have a (file) name.Bye, Olaf.
Side notes: It also helps in situations you SELECT (lcAliasname) instead of SELECT &lcAliasname, though you never have to fear a space
in any alias name, as it’s not allowed — you have to fear having a space in the lcAliasname string value, but a valiad alias name in that variable your responsibility. SELECT
(lcAliasname) also does select the workarea named the same as the value of lcAliasname and does not mean a compilation of that line. Any macro substitution means a compilation of that line of code. An extra step you often can prevent using name expressions
or evaluate.
Olaf Doschke — TMN Systemberatung GmbH
-
Proposed as answer by
Tamar E. GranorEditor
Friday, December 2, 2016 9:28 PM -
Edited by
Olaf Doschke
Monday, December 5, 2016 8:17 AM -
Marked as answer by
Ed Price — MSFTMicrosoft employee
Tuesday, December 20, 2016 6:19 AM
-
Proposed as answer by
Yup, looks like very old code but let me try to help you understand what is going on…
*/ create local memory variables (web_file, web_file2, etc) from properties
*/ that exist on the form (Thisform.mcFile, Thisform.mcFile2) No problems here
web_file = Thisform.mcFile
web_file2 = thisform.mcfile2
web_letter = Thisform.mcLetter
web_gl = Thisform.mcGl
web_gl2 = Thisform.mcGl2
*/ If doing an import of data that is "Date" based, Foxpro will expect it in
*/ Day Month Year format, but you don't appear to be doing anything with it
*/ during your import of CSV file
Set Date To Dmy
*/ Close database(s) that may be open
Close Data
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/ Does the exact same as above with "web_file" and "web_file2",
*/ so you now have two variables each with exact same values...
mcFile = Thisform.mcFile
mcFile2 = Thisform.mcFile2
*/ clear the "wait" window
Wait Clear
*/ Look to see if there is an old version of "Web_Temp.dbf", if so,
*/ delete it and recreate it with the provided "create table" structure.
If File("web_temp.dbf")
Delete File web_temp.Dbf
Endif
Create Table web_temp (;
email1 C(40),;
opentime1 C(40),;
o2idnumb1 C(10))
*/ These three lines are not needed. When you "CREATE TABLE", you are
*/ explicitly STARTING the file in exclusive mode, no need to close
*/ and re-open exclusively.
Use
Select 0
USE web_temp Exclusive
*/ Take the content from the file by the name found in the variable "web_file".
*/ This could cause a problem if the file has embedded spaces in the name...
*/ the preferred method is to use ( parens ). The expectation of "Delim" is
*/ that the file is comma delimited between each expected column name
&& Append From &web_file Delim
Append from (web_file) Delim
*/ Do the same here, but for the second file going into a second
*/ "Temp" table for processing
If File("web_temp2.dbf")
Delete File web_temp2.Dbf
Endif
Create Table web_temp2 (;
email C(40),;
opentime C(40),;
o2idnumb C(10))
*/ Again, dont need this
Use
Select 0
USE web_temp2 Exclusive
&& APPEND FROM &web_file2 Delim
append from (web_file2) Delim
Now, all that said, here is some super shortcuts for you, especially if these are in fact temporary tables that you would otherwise be «discarding» when finished…
*/ The above doesn’t confirm expected files exist, so I would pre-check
if not file( Thisform.mcFile )
messagebox( "Sorry, the file " + Thisform.mcFile + " does not exist" )
return
endif
if not file( Thisform.mcFile2 )
messagebox( "Sorry, the file " + Thisform.mcFile2 + " does not exist" )
return
endif
*/ In case a cursor/table is already open by the name "Web_Temp", close it
use in select( "Web_Temp" )
*/ Create a new table (temporary table that automatically
*/ erases itself when closed when you are finished with it
create cursor Web_Temp (;
email1 C(40),;
opentime1 C(40),;
o2idnumb1 C(10))
*/ Append from the file as before
append from ( Thisform.mcFile ) delim
*/ Go to another "work area" VFP allows up to 65535 different work areas, but if you
*/ ever needed that many tables open simultaneously, you have bigger problems.
select 0
*/ Same here, but for your SECOND table
use in select( "Web_Temp2" )
Create cursor web_temp2 (;
email C(40),;
opentime C(40),;
o2idnumb C(10))
*/ Append from the file as before
append from ( Thisform.mcFile2 ) delim
*/ Done, continue with rest
If you have a file that is underlying as hex values, they’ll just be pulled-in verbatim as would be seen in a notepad editor. (or via MODIFY COMMAND NameOfTheFile) from within VFP
SpiritAT 3 / 3 / 0 Регистрация: 02.09.2011 Сообщений: 107 |
||||||||
1 |
||||||||
29.03.2012, 12:40. Показов 6091. Ответов 9 Метки нет (Все метки)
Вот подключение
сам код
но кидает ошибку при компилирование и не могу понять что не так
0 |
12 / 12 / 2 Регистрация: 28.03.2012 Сообщений: 49 |
|
29.03.2012, 13:43 |
2 |
попробуй вместо executenonquery
1 |
414 / 265 / 25 Регистрация: 03.10.2011 Сообщений: 1,079 |
|
29.03.2012, 13:47 |
3 |
Подозреваю, что дело в строке подключения. Так как для атрибута DataSource должен быть указан конечный файла (если конечно предположить что БД хранится в отдельном файле к которому вы подключаетесь). Добавлено через 3 минуты
1 |
3 / 3 / 0 Регистрация: 02.09.2011 Сообщений: 107 |
|
29.03.2012, 14:06 [ТС] |
4 |
Подозреваю, что дело в строке подключения. Так как для атрибута DataSource должен быть указан конечный файла (если конечно предположить что БД хранится в отдельном файле к которому вы подключаетесь). Добавлено через 3 минуты да к базе я подключяюсь отдельно
0 |
340 / 340 / 90 Регистрация: 04.03.2010 Сообщений: 648 |
|
29.03.2012, 14:08 |
5 |
Command содержит непризнанные фраза по-русски вроде бы написано, проверьте запрос, который формируете к бд
0 |
414 / 265 / 25 Регистрация: 03.10.2011 Сообщений: 1,079 |
|
29.03.2012, 14:19 |
6 |
1. Строку подключения надо пересмотреть. Добавлено через 9 минут
Цитата Сообщение от SpiritAT Посмотреть сообщение Command — может подразумевать не только запрос.
но кидает ошибку при компилирование т.е. если это действительно ошибка компиляции, а не выполнения, то до запроса дело дойти еще не должно.
0 |
124 / 106 / 7 Регистрация: 14.02.2010 Сообщений: 263 |
|
29.03.2012, 14:23 |
7 |
sql = string.Format(«select nom_fil as A,'{0}’ as B,'{0}’ as C,'{0}’ as D, ‘{0}’ as E, ‘{0}’ as F, ‘{0}’ as G into table {1} from {2}», _30spaces, tableFinal, tableTop); О_о шо эта? зачем эта?
0 |
_katon_ 414 / 265 / 25 Регистрация: 03.10.2011 Сообщений: 1,079 |
||||
29.03.2012, 14:36 |
8 |
|||
А не!! andrew_w2k, прав! «Command contains unrecognized phrase/keyword» — это к ошибке в запросе. Значит — это ошибка выполнения. Все равно я очень сомневаюсь, что соединение с файлом БД установлено!
FOX?
0 |
project.web 12 / 12 / 2 Регистрация: 28.03.2012 Сообщений: 49 |
||||||||||||
29.03.2012, 14:36 |
9 |
|||||||||||
Для справки.
используется для запросов не возвращающих данных
для выражений возвращающих одно значение
для выражений возвращающих таблицы
0 |
3 / 3 / 0 Регистрация: 02.09.2011 Сообщений: 107 |
|
29.03.2012, 14:43 [ТС] |
10 |
О_о шо эта? зачем эта? это запрос который создает базу забирая поля с другой базы и да это FoxPro
0 |
Troubleshooting
Problem
Error number -239:
DMS-E-General, A general exception has occurred during operation ‘prepare request’
DMS-E-DBPARSER, the underlying database detected an error during processing of the SQL request.
[Microsoft][ODBC Visual FoxPro Driver] command contains unrecognized phrase/keyword.
This error occurs when creating a report in Impromptu 5.0. and accessing a FoxPro 5.0a database.
Resolving The Problem
Your tables may have been qualified with a name that is unrecognizable by your driver. Qualifying less removes a qualification from your table name, thus eliminating the unrecognizable name.
To qualify tables less, perform the following
Steps:1. Close the report
2. On the Catalog menu, select Tables and open the Qualifications tab
3. Qualify Less on the tables in the catalog
4. Open the report
[{«Product»:{«code»:»SSTQPQ»,»label»:»IBM Cognos Series 7 PowerPlay»},»Business Unit»:{«code»:»BU059″,»label»:»IBM Software w\/o TPS»},»Component»:»Impromptu»,»Platform»:[{«code»:»PF025″,»label»:»Platform Independent»},{«code»:»PF033″,»label»:»Windows»}],»Version»:»Cognos 8 BI Transformer 7.3;Impromptu 5.0;Impromptu 7.1″,»Edition»:»»,»Line of Business»:{«code»:»LOB10″,»label»:»Data and AI»}},{«Product»:{«code»:»SSEP7J»,»label»:»Cognos Business Intelligence»},»Business Unit»:{«code»:»BU053″,»label»:»Cloud \u0026 Data Platform»},»Component»:»Transformer»,»Platform»:[{«code»:»»,»label»:»»}],»Version»:»»,»Edition»:»»,»Line of Business»:{«code»:»»,»label»:»»}},{«Product»:{«code»:»SSTQPQ»,»label»:»IBM Cognos Series 7 PowerPlay»},»Business Unit»:{«code»:»BU059″,»label»:»IBM Software w\/o TPS»},»Component»:»Impromptu»,»Platform»:[{«code»:»»,»label»:»»}],»Version»:»»,»Edition»:»»,»Line of Business»:{«code»:»LOB10″,»label»:»Data and AI»}}]
- Remove From My Forums
-
Question
-
Good afternoon !
vfp 9
I am trying to insert information into a table in postgre.
error example
SQLEXEC(gnconnect,»INSERT INTO clientes(nome_cli,sobrenome_cli,endereco_cli,complemento_cli,telfixo_cli1,telcel_cli2,data_cli,hora_cli,email_cli,uf_cli,estado_cli,cpf_cli,cnpj_cli);
VALUES (‘Rebeca’,’Santos’,’Rua do Jardim’,’N. 448 casa 13′,’21-2775-7572′,’21-97010-7040′,’03/03/2020′,’20:29:00′,’riodejaeiroig.com.br’,’RJ’,’Rio de Janeiro’,’1111111111111′,’1111111111111′)»)When I try to include the above information the error message appears
command contains unrecognized phrase keyword
That can help me.
Adalberto — Thanks!