Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2003
    Location
    Penang, Malaysia
    Posts
    212

    Unanswered: Foxpro DBF table insert statement not working.

    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...
    Patrick Chua
    LBMS ( Learn By My Self) NPQ ( No paper Qualification )

  2. #2
    Join Date
    Nov 2004
    Posts
    2

    Try this

    in command prompt

    append blank
    replace acc_no with "2004/11"


  3. #3
    Join Date
    Jul 2003
    Location
    Penang, Malaysia
    Posts
    212
    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
    LBMS ( Learn By My Self) NPQ ( No paper Qualification )

  4. #4
    Join Date
    Jul 2003
    Location
    Penang, Malaysia
    Posts
    212
    ooh..."append blank" moves the a new record...IC ..IC....
    but then, can please advise why "insert" can't be use?
    Patrick Chua
    LBMS ( Learn By My Self) NPQ ( No paper Qualification )

  5. #5
    Join Date
    Nov 2004
    Posts
    39
    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!

  6. #6
    Join Date
    Jul 2003
    Location
    Penang, Malaysia
    Posts
    212
    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....
    Patrick Chua
    LBMS ( Learn By My Self) NPQ ( No paper Qualification )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •