Accessing Visual FoxPro COM server from VB 6.0 -
the problem related usage of vfp com server visual basic 6.0 (sp 6).
code (relevant)
private movfpserver f_vfpsvr.vfpserver
in sub:
dim orec f_vfpsvr.vfprecord set orec = movfpserver.newrecord("loanmstr") orec .setfield "ssn", sssn .setfield "awdyr", sawardyear .setfield "tran_date", format(now, "mm/dd/yyyy") .commit end
method "newrecord" movfpserver returns object represents new, empty record in vfp table "loanmstr".
code follows populate properties/fields , save data.
all works if vfp com server built using vfp 8.0 , does not work when built using vfp 9.0.
specifically, vb application errors out @ line of code:
set orec = movfpserver.newrecord("stdmstr")
com server throws exception: automation error -2147417851.
this happening on same machine.
vfp built com objects can behave little oddly @ times, when comes trickling errors stack.
but seems strange manifests when built in vfp9. believe there breaking changes in database stuff between 8 , 9 possibly you've hit 1 of them?
do have error function in vfp code? if not, try setting error properties in , interrogating them in vb when error?
ie, have like
function error(nerror, cmethod, nline) this.cerrdesc = "error number: " + transform(nerror) + crlf + "message: " + message() + crlf + "method: " + cmethod + crlf + "line #: " + transform(nline) comreturnerror(cmethod, this.cerrdesc) endfunc
Comments
Post a Comment