PDA

View Full Version : Foxpro DBF table insert statement not working.


Patrick Chua
11-10-04, 12:58
Hi,
I have a job to read a dbf file. I'm a SQL Server user. So I'm not very familr with DBF.

Okay, here is the deal. I am opening this existing DBF file in Microsoft Visual Fox Pro 6.0 .

In the command window, select, update and even including delete statements works .

What is getting on my nerves is the "insert" statement. It always prompts "syntax error". But the @#$@#$ error message just didn't help much.

The funny thing is, if I use the "Append Mode" and add data directly via the GUI, it works!.

Here is the insert statement, just a very simple one:

<code> INSERT INTO ASSET (ACCNO) values '2000/141'</code>


Tell me something I don't know or missing!!!....please...

siska
11-10-04, 15:16
in command prompt

append blank
replace acc_no with "2004/11"

:cool:

Patrick Chua
11-10-04, 23:55
Thanks, but your command just replaces and existing record but did not insert a new record.

Why can I use insert ? I do'nt get it. I've seen many web examples of SQL Statements for *.DBF tables and all are very stragihtforward.


But why..why why I can't execute the insert statement.

Patrick Chua
11-10-04, 23:57
ooh..."append blank" moves the a new record...IC ..IC....
but then, can please advise why "insert" can't be use?

RedAxl
11-23-04, 05:14
The INSERT command in XBase is different from SQL command.

In XBase such as Foxpro,the INSERT (which is also native to
XBase) is the same as APPEND BLANK.

The only difference is that APPEND BLANK always add the record to
the end of the current table.

While the INSERT will insert the new blank record after the current
record. And also, it has the BEFORE option, which if you use, will insert
the new blank record before the current record.


In SQL, INSERT INTO Tablename(F1, ...) VALUES (V1, ...)

Oh nevermind! Im very sure you already know it! :D

Patrick Chua
11-23-04, 10:02
Thank for the info.


I think I still stick to insert statements.

Actually it was just a silly mistake of forgetting to put the "(" ")" after the "values" statment...
eg.

Insert into demo (a) values '1'
instead of
Insert into demo (a) values ('1')
:)

Which actually is abit ambrassing .......hehehehe....