Code: Select all
FUNCTION Start( ) AS VOID
TRY
SetDefault("f:xsharp")
FoxProMessage = "Hello VFP!"
? FoxProMessage
USE deallist
? dealname
SKIP
? dealname
COPY TO test
Use
CATCH e AS Exception
? e:ToString()
END TRY
WAIT
RETURN
Code: Select all
**routine to create a csv file for HBR
procedure make_csv()
parameter csvfilename
local x, xhdr, xtemp, WshShell
xtemp = "temp1.dat"
xhdr = ""
FOR x := 1 to FCOUNT()
xhdr = xhdr + '"'+rtrim(FieldName(x))+'",'
NEXT
fhandle = fcreate(xtemp, 0)
if fhandle < 0
eti_msgbox("Error creating error file: "+ xtemp)
wait
quit
endif
writelen = fwrite(fhandle, xhdr)
if writelen <> len(xhdr)
eti_msgbox("Error writing to "+ xtemp)
quit
endif
fclose(fhandle)
copy to temp2.dat delimited
WshShell = win_OleCreateObject("WScript.Shell")
run_command = 'copy temp1.dat + temp2.dat '+csvfilename+' & del temp1.dat & del temp2.dat & exit'
WshShell:Run("cmd /K "+run_command, 0, 1)
return
I've attached the deallist.DBF file to help determine why the COPY command failed.System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day)
at XSharp.RDD.TEXTRDD._getFieldString(RddFieldInfo oField, Object oValue)
at XSharp.RDD.DELIM._writeRecord()
at XSharp.RDD.TEXTRDD.GoCold()
at XSharp.RDD.TEXTRDD.Append(Boolean lReleaseLock)
at XSharp.RDD.Workarea.TransRec(DbTransInfo info)
at XSharp.RDD.DBF.TransRec(DbTransInfo info)
at XSharp.RDD.Workarea.Trans(DbTransInfo info)
at XSharp.CoreDb.<>c__DisplayClass107_0.<Trans>b__0()
at XSharp.CoreDb.Do[T](Func`1 action)
at XSharp.RT.Functions.DbTrans(__Usual[] Xs$Args)
at XSharp.RT.Functions.DbCopyDelim(__Usual[] Xs$Args)
at XSharpFoxPro1.Exe.Functions.Start() in f:xsharptestappPrgStart.prg:line 11
Press any key to continue...
Regards,
Jeff