Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Problems creating DataTable in .DBF File

Problems creating DataTable in .DBF File

Scheduled Pinned Locked Moved Database
helpquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Snaider
    wrote on last edited by
    #1

    Hi!! I'm having a problem( again) while creating a .dbf file. First, I have this line to create the table: Create Table Results.dbf (BuyDate Date) And this worked well. Now, I've this line to add a date in the table: Insert Into Results.dbf (20070922) But it gives me a "Data type mismacth" error. I've already saw that the date format is YYYYMMDD. So where is the error here?? :confused:

    C K P 3 Replies Last reply
    0
    • S Snaider

      Hi!! I'm having a problem( again) while creating a .dbf file. First, I have this line to create the table: Create Table Results.dbf (BuyDate Date) And this worked well. Now, I've this line to add a date in the table: Insert Into Results.dbf (20070922) But it gives me a "Data type mismacth" error. I've already saw that the date format is YYYYMMDD. So where is the error here?? :confused:

      C Offline
      C Offline
      ChandraRam
      wrote on last edited by
      #2

      Rafael Carmo wrote:

      Hi!! I'm having a problem( again) while creating a .dbf file. First, I have this line to create the table: Create Table Results.dbf (BuyDate Date) And this worked well. Now, I've this line to add a date in the table: Insert Into Results.dbf (20070922) But it gives me a "Data type mismacth" error. I've already saw that the date format is YYYYMMDD. So where is the error here??

      AFAIK, a DBF file stores all data as ASCII text only - maybe this is the issue here...

      S 1 Reply Last reply
      0
      • C ChandraRam

        Rafael Carmo wrote:

        Hi!! I'm having a problem( again) while creating a .dbf file. First, I have this line to create the table: Create Table Results.dbf (BuyDate Date) And this worked well. Now, I've this line to add a date in the table: Insert Into Results.dbf (20070922) But it gives me a "Data type mismacth" error. I've already saw that the date format is YYYYMMDD. So where is the error here??

        AFAIK, a DBF file stores all data as ASCII text only - maybe this is the issue here...

        S Offline
        S Offline
        Snaider
        wrote on last edited by
        #3

        Just only ASCII text?? So why is there a Date format for .dbf file...??? I tried to insert '20070922', "20070922" and this didn't work as well... :(

        C 1 Reply Last reply
        0
        • S Snaider

          Just only ASCII text?? So why is there a Date format for .dbf file...??? I tried to insert '20070922', "20070922" and this didn't work as well... :(

          C Offline
          C Offline
          ChandraRam
          wrote on last edited by
          #4

          Snaider wrote:

          Just only ASCII text?? So why is there a Date format for .dbf file...??? I tried to insert '20070922', "20070922" and this didn't work as well...

          It's been a while since I have seen a DBF file... I think the Date type in a DBF file is a 10-char storage. Maybe you could try '03/13/2008' (depending upon your system locale)

          1 Reply Last reply
          0
          • S Snaider

            Hi!! I'm having a problem( again) while creating a .dbf file. First, I have this line to create the table: Create Table Results.dbf (BuyDate Date) And this worked well. Now, I've this line to add a date in the table: Insert Into Results.dbf (20070922) But it gives me a "Data type mismacth" error. I've already saw that the date format is YYYYMMDD. So where is the error here?? :confused:

            K Offline
            K Offline
            Khawar Abbas1
            wrote on last edited by
            #5

            Try this Insert Into Test2 values ('09/22/2007'); and check the data in database.

            Do good and have good.

            S 1 Reply Last reply
            0
            • K Khawar Abbas1

              Try this Insert Into Test2 values ('09/22/2007'); and check the data in database.

              Do good and have good.

              S Offline
              S Offline
              Snaider
              wrote on last edited by
              #6

              It didn't worked...but I've just find out how to do it: Insert Into Results.dbf Values (CtoD([06/18/2005])) Only by this way it worked. Thx for everybody's help :laugh:

              1 Reply Last reply
              0
              • S Snaider

                Hi!! I'm having a problem( again) while creating a .dbf file. First, I have this line to create the table: Create Table Results.dbf (BuyDate Date) And this worked well. Now, I've this line to add a date in the table: Insert Into Results.dbf (20070922) But it gives me a "Data type mismacth" error. I've already saw that the date format is YYYYMMDD. So where is the error here?? :confused:

                P Offline
                P Offline
                perryf_00
                wrote on last edited by
                #7

                Dang. I'm stuck doing DBF stuff again! But to answer your question, you can use the "CTOD" function as you've seen. Or you can use {} as the field delimiters for an actual date field. So: Insert into Results({09/22/2007})

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups