CREATE TABLE [test.dbf] with numeric filed

CREATE TABLE [test.dbf] with numeric filed

Post by George Got » Sat, 27 Sep 2003 13:30:39


Hi!
I have two strange problems with DBF structure file. Here
is a source code:

Dim lConnection As ADODB.Connection
Dim MyRS As ADODB.Recordset
Private Sub Command1_Click()

Set lConnection = New ADODB.Connection
lConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &
_
"Data Source=C:\;" & _
"Extended Properties=""dBase 5.0;"";"
Call lConnection.Execute("CREATE TABLE [test.dbf]
([TXT] VarChar(9),[Amount] Numeric(19,2))")

Set MyRS = New ADODB.Recordset
MyRS.Open "SELECT * FROM [test.dbf]", lConnection,
adOpenStatic, adLockOptimistic
MyRS.AddNew
MyRS![TXT] = "Row 1"
MyRS![Amount] = 10.02
MyRS.Update

1 problem: created test file contains field [Amount]
with field size 20 and scale 5 , instead 19,2

2 problem: Statement MyRS![Amount] = 10.02 generates
error :
-2147217887 The field is too small to accept the amount
of data you attempted to add. Try inserting or pasting
less data.

Thanks for help.

PS. Decimal field type (instead Numeric generates same
error)
 
 
 

CREATE TABLE [test.dbf] with numeric filed

Post by Simon Robe » Sun, 28 Sep 2003 06:55:33


$ XXXX@XXXXX.COM :



This section you might want to try talking to the database in c ansi
standard..

ie..

lConnection.Execute "INSERT INTO [test.dbf] etc...


Simon

ps.. i had a similar problem with MySQL