Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C0000005 problem inserting dates in year 2120
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
C0000005 problem inserting dates in year 2120
Miscellaneous
Thread ID:
00832577
Message ID:
00832577
Views:
63
Hi,

We have an application that manages cost data over time and one of our clients has a project which involves data out to the year 2180 and beyond. We use a SQL back end (Oracle or SQL Server) and have discovered that if we try to append data into our database using an updateable cursor or view VFP gives error C0000005 for any date in the year 2120. Dates before and after that year are fine.

This happens in VFP 7 and VFP 8 and for Oracle or SQL Server.

The code at the bottom of this message will generate the error.

Has anybody else experienced this error or know why it occurs.
--------------------------------------------------------------------

LPARAMETERS tcDSN, tcUID, tcPWD
LOCAL h, e, i

close All

*************************************************************************
* Delete existing local data first, so we get a fresh test
*************************************************************************
if file( "test2120.*" )
	delete File test2120.dbc
	delete File test2120.dct
	delete File test2120.dcx
	delete File test2120.dbf
	delete File test2120.cdx
endif

*************************************************************************
* Create source data
*************************************************************************
create Table source2120 free ( df_key c(8), df_date d )
index on df_key tag source_key
for i = 1 to 100
	insert into source2120 ( df_key, df_date ) values ( ltrim(str(i)), {^2120/1/1} + i - 1 )
next
use in source2120

*************************************************************************
* Connect
*************************************************************************
h = sqlconnect( tcDSN, tcUID, tcPWD )

*************************************************************************
* Create remote table, dropping any existing table first
* Note: If using SQL Server, use DATETIME for df_date field.
*		If using Oracle, use DATE for df_date field.
*************************************************************************
e = sqlexec( h, 'drop table test2120' )
e = sqlexec( h, 'create table test2120 ( df_key char(8), df_date datetime)' )
if e < 0
	? 'Error'
	return .f.
endif

*************************************************************************
* Create local database and view, deleting existing copies first.
*************************************************************************
create database test2120
create Connection con DATASOURCE ( tcDSN ) USERID ( tcUID ) PASSWORD ( tcPWD )
create sql view test2120 REMOTE CONNECTION con AS SELECT * FROM test2120
DBSetProp("test2120", 'View', 'UpdateType', 	1 )
DBSetProp("test2120", 'View', 'WhereType', 		3 )
DBSetProp("test2120", 'View', 'SendUpdates', 	.T. )
DBSetProp("test2120", 'View', 'Tables', 		"test2120" )
DBSetProp("test2120", 'View', 'Prepared', 		.F. )
DBSetProp("test2120", 'View', 'CompareMemo', 	.F. )
DBSetProp("test2120", 'View', 'FetchAsNeeded', 	.F. )
close Databases

*************************************************************************
* Append local data into remote table
*************************************************************************
open database test2120
use test2120!test2120
append from source2120
tableupdate(0,.T.)

*************************************************************************
* Check contents of remote table, IF it gets this far.
*************************************************************************
? sqlexec( h, "select * from test2120" )
---------------------------
Mike Boulton
WST Pacific Pty Ltd
65 Henley Beach Road
Mile End, South Australia 5031
Tel: +61 8 8150 5500
Web: www.wstpacific.com.au
Next
Reply
Map
View

Click here to load this message in the networking platform