Page 1 of 1

Append first row to DBF with SQL ODBC

Posted: Thu Mar 29, 2018 5:03 am
by Victorio
Hi,
I know, this is express forum, but maye somebody know some idea.
I open Visual Foxpro database (DBF) with ODBC driver (SQL Express).
When want append first row, not work
But when append first row in Visual Foxpro after it can appending other rows.

Also in DCBROWSE, when in numeric column all values are zero, browser show blank place, but when any row has number 1,2,... then show in column also zeros.

Re: Append first row to DBF with SQL ODBC

Posted: Thu Mar 29, 2018 7:58 am
by rdonnay
For your DCBROWSE problem, use a PICTURE clause, ie. PICTURE '99999' and make sure that the column width is wide enough to show the number.

Re: Append first row to DBF with SQL ODBC

Posted: Thu Mar 29, 2018 9:53 am
by Victorio
I mean this is not picture problem, so I can try
But now I found solution this:
first when open DBF I test if database has some record, when no,
then append one "start" record.
after it program works.

pz:=oCursorolp:reccount()
if pz=0
oCursorolp:Append({1,"99999","1","1",date(),date()+1,1,1,"1",1,"1","1",1,"1","1",1,1,1,3,1,1,1})
oCursorolp:commit()
oCursorolp:UpdateRow()
oCursorolp:Refresh()
endif

also I must do append in one row, and put all values.

And I do not know, it this is also needs, in source DBF file I enable NULL values, but now works.

This is temporary solution, because with Visual Foxpro ODBC I have more problems, and it is no support for it, later I must change to other type database