Recent

Author Topic: LAZARUS RECORD type  (Read 677 times)

stratocruiser

  • Newbie
  • Posts: 3
LAZARUS RECORD type
« on: December 19, 2019, 01:16:37 pm »
Hi,
Hope someone can help. I am new to Lazarus(and Pascal) and learning fast. Some years ago I created a simple database using VisualBasic 6 using the record type to create fixed length records. I am now trying to re-write my database using Lazarus, but I cannot get the record type to work properly. It does read the file , but selecting a field to print results in truncated, corrupt, but nearly recognisable data. Sometimes it seems to read several fields when I only request one. I have checked to make sure I declared VB6 integers in the original VB record correctly using the equivalent Pascal type (smallint). But no joy. After reading a little I tried declaring the Lazarus record as a packed record - again with no luck. I would hate to have to create the database from scratch as it contains 700 records with much of the data hard to replace. Would gratefully accept any suggestions as to how I might approach this issue.

vangli

  • New Member
  • *
  • Posts: 25
Re: LAZARUS RECORD type
« Reply #1 on: December 19, 2019, 01:28:03 pm »
What is your record definition and how do you read it?
Regards Bent

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9036
  • FPC developer.
Re: LAZARUS RECORD type
« Reply #2 on: December 19, 2019, 03:10:37 pm »
Start comparing the sizes of your record definitions and make sure they match.

MarkMLl

  • Hero Member
  • *****
  • Posts: 1825
Re: LAZARUS RECORD type
« Reply #3 on: December 19, 2019, 03:19:03 pm »
Also is VB saving all text as (16-bit?) Unicode?

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

Thaddy

  • Hero Member
  • *****
  • Posts: 10698
Re: LAZARUS RECORD type
« Reply #4 on: December 19, 2019, 03:41:03 pm »
Also is VB saving all text as (16-bit?) Unicode?

MarkMLl
THAT VB is Ansi. It aligns on two bytes/ 16 bits. There should be no problem reading/writing it.

wp

  • Hero Member
  • *****
  • Posts: 7978
Re: LAZARUS RECORD type
« Reply #5 on: December 19, 2019, 04:25:19 pm »
That, what you call "database", is that a file of fixed-size records? What is the record declaration for VB6? And can you post the file written by VB? If you don't want to publish it, you can sent it to me personally (send me a PM with your e-mail address and I send you mine). You could also investigate the structure of the file with a hex editor. My own hex editor (https://github.com/wp-xyz/Hex) allows to define records so that you can peek into the file and easily find out whether the record definition is correct.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

 

TinyPortal © 2005-2018