Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble Calling a FoxPro Stored Procedure from .NET

Status
Not open for further replies.

jbailey268

Programmer
May 25, 2005
51
US
Hope this is the right forum. I am using VFP 8.

It seems like all works well with calling a stored procedure in a DBC remotely from .NET. For this I am gratified.

The trouble starts when I start to get fancy or complex in my DBC stored procedure. I get errors (within .NET) when I put in my stored procedure a class like as follows-

Procedure getLicense
para t1,t2,t3

DEFINE CLASS license AS CUSTOM OLEPUBLIC

PROC PROC1
<code>
ENDPROC
PROC PROC1
<code>
ENDPROC

ENDDEFINE

Endproc && end of procedure getLicense

I even tried putting the entire DEFINE Class after the end of my last ENDPROC in my stored procedures. Didn't help.
It seems to work ok from the VFP command window. So the code part is sound.

Question: Is there something special one needs to do when the stored procedure is more complicated than plain vanilla code. I have a Createobject in there which calls a non-visual dll. Is this taboo?
Simpler versions of the programming code are called from within .NET and seem to pass params back and forth just fine, as long as there's no define class or create object. Is that the way it's gonna be?

Anyone have any experience with this? Thanks for any help.

 
It seems to work ok from the VFP command window. So the code part is sound.

When you say it works from the Command Window, how are you creating and destroying the license class? I don't see that in your code.

I have never tried it, but I wouldn't be surprised if you can't use DEFINE CLASS in a stored procedure. It can't be used inside program flow structures.

pamela
 
Sorry for the delay.

I do have DEFINE CLASS license AS CUSTOM OLEPUBLIC
(see above)

What I had to do to get the thing to work properly was to get rid of the define class and then of course all references to THIS.F_GETlicense and make it F_GETlicense.

Anyway I did get it working. I did notice that I got an invlaid command or a not supported from the Web Interface when the simple word "Loop" appears in my stored procedure.
Namely

for i = 1 to 10
if i = 5
loop
endif
<commands>
next

Very odd. I had to fix it by creating flags and going around the commands if the flag was true. Some kluge like that.
Thanks for your help Pamela.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top