CodeBase 6 Hints

This document provides a list of solutions for common problems and answers to frequently asked questions.

Common problems

Frequently Asked Questions

Other CodeBase Errors

 

Common problems

Invalid Transaction file (error -1210) when opening file

When CodeBase first opens a database, if a log file has not yet been opened, CodeBase will look for one called C4.LOG in the current directory and open it if found. This is to prepare for transaction processing. When this error occurs, CodeBase has found such a file, but its contents are invalid. This could be due to a power failure or program crash that occurred during the last time the log file was written to.

If the integrity of the log file is important, use CodeUtil (in Windows) or the utility functions (in other operating systems) to repair the log file. Otherwise, simply delete the log file if it is not important.

If you do not intend to use a log file in your application at all, you can force CodeBase to NOT automatically open the log file by calling code4logOpenOff() before you open any database files.


CodeBase not working after error

When a CodeBase error is generated in C, C++, Visual Basic or Delphi, CODE4.errorCode (or Code4::errorCode in C++) is set to a negative value to indicate the error that occurred. In order to resume, you must acknowledge the error by setting the errorCode value back to zero.

Frequent Index Corruption under Windows 95

This problem is common in Windows 95 OEM Service Release 2.x. The source of the problem is the file VREDIR.VXD. Microsoft has provided a new version (210k) for Windows 95 that will fix this problem. The patch executable is a self installing program which will install itself and make the needed changes to your Windows setup.

More information on this bug can be found in article Q174371 in the Microsoft Knowledge Base.

more...


Design-time license error when using CodeControls

There are two common causes of this error:
  1. The CodeBase Administrator was installed or re-installed after the installation of the CodeControls. This results in the CodeBase Administrator's set of CodeControls, which does not have a design-time license, to be registered, overwriting the registration of the CodeControls with the design-time license. The CodeControl OCX files in the \CodeBase\CodeCtrl directory must be re-registered using the instructions on page 190 of the CodeControl 3 manual.
  2. The CodeBase 6.5 CodeControls were registered with the wrong set of design-time license files. The correct set of license files can be downloaded from here to replace the existing ones in the \CodeBase\CodeCtrl directory, and then the CodeControl OCX files can be re-registered using the instructions on page 190 of the CodeControl 3 manual.

Specified driver could not be loaded due to system error 127 (CodeBaseOdbcStand)

The current releases of the stand-alone CodeBase SQL/ODBC use their own version of the c4dll.dll.  However, the installation program for the driver will not install its c4dll.dll over any pre-existing c4dll.dll in the \Windows\System or \WinNT\System32 directory. The c4dll.dll that is currently in the \Windows\System or \WinNT\System32 directory must be removed, then the stand-alone CodeBase SQL/ODBC must be un-installed and re-installed.

Invalid Session Option error when using CodeBase SQL/ODBC

If you are using CodeBase SQL/ODBC on a non-English version of the Windows operating systems, this message may appear. When you do not specify a CodePage for the CodeBase SQL/ODBC to use, it will try to use the CodePage of the operating system. However, if the operating system is not using CodePage 437 or 1252, then this error will occur. Therefore, to avoid this error, you need to specify the CodePage in the connection string of the driver. For instance, "DSN=CodeBaseOdbcStand;UID=;CodePage=437".

Stand-alone CodeBase SQL/ODBC will not return more than 254 columns

There is a change you can make to the Windows registry settings of the driver to increase the number of columns that it returns. Open the Windows Registry Editor, and if you are using the default DSN CodeBaseOdbcStand, go to HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\CodeBaseOdbcStand where you will find several values already there (e.g. DBQ, Locking Attempts).  Add a new string value called MaxColSupport, and assign it a number no greater than the limits given for column support in the CodeBase ODBC help file. If you have created your own DSN, you will need to make the change to your DSN's registry settings, located under either HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ or HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\

-50 (e4lock) error when using large file support on Windows 9x/ME

Windows 9x/ME does not support file locking at large (>4GB) file offsets. To work around this, files should be opened exclusively in CodeBase, so that locking is not required.

Structure Verification Failure (error -960) when using CodeBase 6.5 and C++Builder 4 or 5

This is due to a difference between the compiler options used to build the CodeBase libraries, and the ones you are using to build your application under C++Builder. Specifically, the CodeBase libraries are compiled use the -b compiler option, which causes the compiler to make enumerated data types integer-sized. However, projects created by C++Builder use the -b- compiler option by default, which makes enumerated data types byte-sized.

Under C++Builder 4, use the Project|View Makefile menu command to examine the makefile for your project. In the makefile, there is a variable called CFLAG1 that is assigned several compiler options. Change the -b- option to -b, and save the makefile.

Under C++Builder 5, use the Project|Options menu command, and go to the Compiler tab. Under the Compiling section, check the box besides "Treat enum types as ints" and click the OK button.


Windows NT

A number of problems that arise when using Windows NT can be fixed by installing the latest Windows NT Service Pack. The problems that are solved include memory leaks and interaction with NetWare drives.

Novell and Windows

Sometimes CodeBase will generate a -200 error when opening a file on a NetWare drive. This is solved by downloading an updated Windows Novell Driver.

NetBEUI

The NetBEUI driver has been found to work better than other protocols like IPX/SPX when Windows 95 clients are accessing data on a Windows NT server.

Unresolved External Symbol operator new

When compiling with Microsoft Visual C++, the following error might be generated:

libcimtd.lib(iostrini.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)"

This is caused by using the wrong run-time library. For the Release configuration, use the Multithreaded run-time library. For the Debug configuration, use the Debug Multithreaded run-time library.

CodeUtil

The CodeBase installation program is not always able to register the control COMDLG16.OCX. To register it yourself, use the MSAREG.EXE utility provided in the CODEUTIL\SYSTEM directory.

msareg comdlg16.ocx


beginthread Error Building DLL

This error appears when building C4DLL.DLL with Microsoft Visual C++ 4.X with the calling convention set to stdcall. To fix this, go into Build | Settings | C/C++ and change Category to Code Generation. Then change Calling Convention to _cdecl*.

UNIX bus errors or core dumps

Some UNIX systems require that data in memory is stored on strict byte boundaries. If these boundaries are violated, a system error will usually occur. To ensure that CodeBase adheres to these boundaries, set S4DATA_ALIGN in p4port.h.

Link Error: LIBCI.LIB cannot be found

This link error is caused by a change in the run-time libraries of Microsoft Visual C++. In version MSVC++ 4.1 and previous, all of the iostream functions were located in LIBC.LIB, LIBCMT.LIB and MSVCRT.LIB. However, with MSVC++ 4.2 and later versions, these iostream functions were moved to their own libraries, called LIBCI.LIB, LIBCIMT.LIB and MSVCIRT.LIB respectively. Because the prebuilt CodeBase libraries for MSVC++ 4.0 were actually built with MSVC++ 4.2, they require the newer run-time libraries. To get around this problem, rebuild the CodeBase libraries using your version of MSVC++ 4.x.

Class not registered. Looking for object with CLSID: {...}

This error message occurs when you try to open the Properties pages of the CodeControls, but there are missing entries in your computer's system registry. You can manually add these missing entries to the system registry by using REGEDIT.EXE. In the MyComputer\HKEY_CLASSES_ROOT\CLSID folder, use Edit | New | Key from the REGEDIT.EXE menu, to add these three keys (the curly braces must be included):

{0BE35200-8F91-11CE-9DE3-00AA004BB851}
{0BE35201-8F91-11CE-9DE3-00AA004BB851}
{0BE35202-8F91-11CE-9DE3-00AA004BB851}

When you select any of these keys, the window on the right of REGEDIT.EXE displays its default value. Right click on the word Default, select Modify from the pop-up menu and change the default values of the keys to the following:

{0BE35200-8F91-11CE-9DE3-00AA004BB851} - "Font Property Page"
{0BE35201-8F91-11CE-9DE3-00AA004BB851} - "Color Property Page"
{0BE35202-8F91-11CE-9DE3-00AA004BB851} - "Picture Property Page"

Each of the above keys should have its own subkey called InprocServer32, which can also be created by using Edit | New | Key. The default value of InprocServer32 should be the full path to where MFC40.DLL has been installed on your computer (i.e.. "C:\WINDOWS\SYSTEM\MFC40.DLL" or "C:\WINNT\SYSTEM32\MFC40.DLL").

Overflow Error calling report4parent()

There is a mistake in the declaration of report4parent() in CODEBASE.BAS which causes an overflow error when you run your program. Instead of:

Declare Function report4parent% Lib "c4dll.dll" (ByVal r4&, ByVal hWnd%)

it should read:

Declare Function report4parent% Lib "c4dll.dll" (ByVal r4&, ByVal hWnd&)

The character after the hWnd must be changed from a '%' to a '&' to avoid this error.

Visual C++ 6 support

Visual C++ 6 will work with the pre-built CodeBase 6.4 DLLs.

Visual C++ 6 may generate compile errors when rebuilding the CodeBase static library or DLL. If this occurs, download these fixed CodeBase 6.4 source files and place them in your SOURCE directory.

Visual C++ 6 will work with CodeControls 3, but the example projects for Visual C++ 5 that come with CodeBase 6.4 will not work with Visual C++ 6. These example projects have been updated for Visual C++ 6.

Two example source files will not compile with Visual C++ 6. These example source files have been updated to work.


Windows 98 GPF during installation

A GPF can occur while running the CodeBase 6.4 install program. It occurs when the Browse button in the "Choose Destination Location" window is pressed. There are two solutions to this problem:
  1. Restart the computer and run the installation program again before running any other programs. Do not click the Browse button; you will not be able to modify the directory CodeBase is installed to.
  2. Copy the files directly from the CD. The files on the CD are not compressed, so they can be copied directly to your hard drive. Stand-alone support can be found in the CB65 directory, and client/server support can be found in the CB65CS directory. NOTE: If you wish to use CodeControls, you will have to manually register the OCX files with REGSVR32.EXE.

Exceeding the 64K default data segment limit in a DOS application

This error can sometimes be resolved by re-building the CodeBase client library with the E4OFF_STRING compiler switch. This should free up approximately 40K in your default data segment. With this switch set, CodeBase error messages will only output error numbers, without any text information about the error. You can cross reference the error message by looking up the error numbers in E4STRING.C.

Frequently Asked Questions

How can I use CodeBase client/server with WinProxy 2.1?

What Files are used by CodeBase?

Description
File Extension
FoxPro
dBASE IV
Clipper
Data File
DBF 
DBF 
DBF 
Memo File
FPT 
DBT 
DBT 
Index File
CDX 
MDX 
CGP, NTX 

Data File: A file with the DBF extension. It contains all the non-memo entries.

Memo File: A file with either a DBT or FPT extension. It contains all memo entries.

Group File:A file with a CGP extension. This file is unique to CodeBase and is used only in the Clipper case. It contains the names of the index files.

Index File:A file with a CDX, MDX or NTX extension. This file contains the sort order of the data file.

For further information about the contents of the above files, please consult other questions in this document or the User's and Reference Guides.


What is the difference between opening a file in read-only mode, and opening the file in exclusive mode?


How can files be opened in different modes?



I get an error after opening several files simultaneously. However, if I first close some files, and then open the rest, everything is fine.


When I change my database on one workstation, who do the changes not appear on another workstation and I receive errors?


Why do I have trouble with relations when I am using two files that have the same name, even if they are in different directories?


What is a BLOB?


If I search for the string "JOHN", I get a return code of 0 (r4success in Appendix B), yet I am positioned on record "JOHNSON". How do I perform an exact match and find only "JOHN" ?


How can I perform a case-insensitive search?


What is the difference between a TAG and an INDEX?


When I try to open my DBF, I get an error #-60: "Unable to open XXX.CGP." What is a .CGP file?


How are indexes in a non-default directory and indexes with non-standard name extensions used with CodeBase?



Why are all unique tags set to r4uniqueContinue, even though they were created with the r4unique option?



Why is my r4uniqueContinue tag not properly updated?

How can I get the number of records that an index contains? For example, if an index has the '.NOT. DELETED()' filter, how do I find the number of undeleted records?

How do I create a tag consisting of two numerical fields?

How do I seek for a Unicode string?


How do I seek for a value in a DateTime field?



How can I filter out deleted records when browsing a data file?

What are the criteria for Query Optimization (QO) technology to be activated?

Why can QO not use a r4uniqueContinue tag?



Why are some slaves in a relation set blank?
When the relation matches master to slave, only one slave is matched to a master at one time.

Here is an example:
 
name.dbf
ID F_NAME L_NAME
1 JOHN BROWN
phone.dbf
ID PHONE_NUM
1 444-5555
1 555-4444
internet.dbf
ID E_MAIL
1 john@abc.com
1 jbrown@xyz.com
1 jb@isp.com

Both internet and phone are slaves of name. So name relates to phone; and name relates to internet. But internet and phone do not relate to each other.

Assuming there is no query, as you skip through the relation, the records will look like this:
 
NAME PHONE_NUM E_MAIL
JOHN BROWN 444-5555 <BLANK>
JOHN BROWN 555-4444 <BLANK>
JOHN BROWN <BLANK> john@abc.com
JOHN BROWN <BLANK> jbrown@xyz.com
JOHN BROWN <BLANK> jb@kkk.com

If you create a query such as "PHONE_NUM = '444-5555' .AND. E_MAIL = 'john@abc.com'", you would not find any records.



When a query that uses Query Optimization technology (QO) is made, how is it possible to find out the number of records that are returned?

How can fields from different files be referenced in a query?


Is it possible to have a master file with multiple relations to the same slave file?



What is code4calcCreate() used for?

How do I shorten an expression with code4calcCreate?

How can fields be concatenated (linked together) into a meaningful expression?

How is a query with a date field made?



When I append many records to file, why does performance gradually degrade after the first few hundred records?

How can I ensure optimal performance of the CodeBase database server?



How do I know what host name to pass to code4connect()?

Can I speed up the time it takes to display a sorted report? I am using the Report | Sort Expression dialog box.


How is it possible to calculate a total without showing it on the screen?



How do I re-compile any of the launch utilities?
    To compile LAUNCH_W.C or LAUNCH_D.C, follow the steps below:
  1. Switch to the CODEREP\LAUNCH directory.
  2. COPY ..\..\<LANG>\SOURCE\*.H
    1. Where <LANG> is the 'C' or 'CPP' directory name.
  3. Edit D4ALL.H and change the appropriate switches for the target application type.
  4. Run the appropriate .MAK/.IDE file to compile the executable.


Why are all reports printed from DOS double spaced and have extra blank pages in the middle and end?

How can I make my report page size on screen identical to the sheets I use for my printer?

After viewing one report with an invalid printer driver, why do subsequent reports also appear blank?

Situation
The default printer is set in Windows to a printer with an invalid printer driver. CodeReporter is loaded and a report is opened. A print preview shows that the report is blank. This is correct because the printer does not exist (invalid device driver). A new printer is selected with a valid driver. The reports still display as blanks.
Answer
After selecting a legitimate printer, the report margins must be reset by the user to valid values. For instance, set all margins to one inch.
Explanation
A device driver may be invalid because the printer is not connected. Therefore, a printer device context is not allocated. Consequently, the report margins are not valid. When another (valid) printer driver is selected, CodeReporter corrects its setup of the report. However, the margins are not changed since only the user may change them.


Other CodeBase Errors

Error Number: -1 or e4codeBase

Possible Cause
A previous CodeBase error causes CodeBase function calls to return -1.
Explanation
When a call to a CodeBase function fails, CODE4.errorCode is set to a particular error code. These codes may be found in the 'Error Codes' Appendix of the Reference Guide. When the error code is set to a number less than 0, each subsequent CodeBase function will simply return a -1, without executing the function. This is done for safety purposes.
Solution
Set CODE4.errorCode to 0 after an error has occurred.

    C ExampleC++ ExampleVisual Basic ExampleDelphi Example


Error Number: -20

Description
Unable to create file
Possible Cause #1
The specified file already exists.
By default, when CodeBase attempts to create a data, index, or memo file, it does not over-write any existing file of the same name, and instead returns an error. This default behavior is specified by the value contained in the CODE4.safety member variable, which is set to 1 by default. To create a file if one by the same name already exists, set CODE4.safety to 0. See the example for CODE4.safety in the Reference Guide.
Possible Cause #2
CodeBase ran out of valid file handles.
Stand-alone 16-bit C/C++ applications
By default, only 20 file handles are available to 16-bit applications at any one time, regardless of the settings in CONFIG.SYS. Five of these handles are used by default devices such as STDOUT, STDPRN, etc. This leaves 15 file handles available for the application. Opening one data file can use up to three handles if there is also an associated index and memo file. To overcome this limitation, refer to the CodeBase COMPILER.TXT file, found in the CodeBase compiler directory for your compiler (e.g. \MSC15). If the outlined procedure is not satisfactory, contact the maker of your compiler. It is important to understand that this limitation is due to both the operating system and the compiler, not CodeBase.

Error Number: -30

Description
Determining File Length
Possible Cause
CodeBase ran out of valid file handles.
Explanation:
See Error -20.

Error Number: -440

Description
Overflow while evaluating expression
Possible Cause
The expression passed to expr4parse is too long.
Explanation:
The parsing algorithm limits the number of comparisons made in a query. Thus, very long expressions may not be parsed.
Solution
Use code4calcCreate to "shorten" the expression.

Error Number: -910

Description
Unexpected Information. Database file already open
Possible Cause
The file that is being opened has been opened previously.
Explanation
Each opened file is assigned an alias. Furthermore, no two files may share the same alias. The above error occurs when an attempt to open a file with an alias that already exists is made.
Solution
Change the file's alias with d4aliasSet, or call d4openClone() which will give a new handle to the open data file with the same alias without generated the alias error. If you need specify the data alias via a function call or through an expression, it is not defined which data handle you will get, so use with caution.

See also: d4aliasSet, d4openClone


Error Number: -930

Description
Unexpected Parameter
Possible Cause
A call to a CodeBase function included a parameter that was not valid.
Explanation
In some cases the programmer will forget to initialize some pointers.
Solution
Initialize the appropriate pointer.

Back to the Sequiter Tech Support Page

Sequiter Home Page