Recent

Author Topic: LAZARUS RECORD type  (Read 1382 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: 44
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

  • Administrator
  • Hero Member
  • *
  • Posts: 11444
  • 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: 6682
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 14357
  • Sensorship about opinions does not belong here.
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.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

wp

  • Hero Member
  • *****
  • Posts: 11906
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.

 

TinyPortal © 2005-2018