Recent

Author Topic: import from excel  (Read 764 times)

flori

  • Full Member
  • ***
  • Posts: 196
import from excel
« on: April 06, 2020, 06:59:14 pm »
Hi friends!
When I import the data into the database, I get an error (I attached). The error comes out because the ID is not written in excel. But, when I change ID (small integer) then I don't get the problem.
How should I do that ID, stay integer and don't write this problem?
Excel just will be the blank. The ID will not be filled out.

Thank you
« Last Edit: April 06, 2020, 09:39:47 pm by flori »

wp

  • Hero Member
  • *****
  • Posts: 11854
Re: import from excel
« Reply #1 on: April 06, 2020, 07:44:25 pm »
Could you post the demo directly in the forum? Code posted on file sharing sites will be gone some day, and users seeing this thread in the future will not benefit from a solution.

In order to attach code to a forum post put all required files into a common zip which you can upload under "Attachments and other options" below the edit field of the message editor. Please do not add the exe and other compiler generated files, otherwise the zip will be too large. Add only .pas, .lfm, .lpi, and .lpr files as well as required data files (database file, Excel file).

I did look into you file hoster upload already, and saw that the gdb file may be too large. Please delete as many records as possible, or create a dummy file in a way that the bug is still visible.

Sorry, I have to insist on having the compilable project here in the forum.
« Last Edit: April 06, 2020, 07:51:01 pm by wp »

wp

  • Hero Member
  • *****
  • Posts: 11854
Re: import from excel
« Reply #2 on: April 06, 2020, 07:57:38 pm »
it will always be available here. ok?
No. I think it is possible to delete all but a few records from the gdb file. I don't know if this applies, but you also should take care of not sharing non-public information in the gdb file.

flori

  • Full Member
  • ***
  • Posts: 196
Re: import from excel
« Reply #3 on: April 06, 2020, 09:47:24 pm »
Problem solved.


 ZQuery1.Insert;
                    for c := 0 to maxc do begin
                      datacell := worksheet.GetCell(r, c);
                      case ZQuery1.Fields[c].DataType of


I modified
 ZQuery1.Insert;
                    for c := 1 to maxc do begin
                      datacell := worksheet.GetCell(r, c);
                      case ZQuery1.Fields[c].DataType of

wp

  • Hero Member
  • *****
  • Posts: 11854
Re: import from excel
« Reply #4 on: April 06, 2020, 10:01:35 pm »
Nice that you could fix it yourself.

 

TinyPortal © 2005-2018