Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pass a web variable to a stored procedure
Message
De
28/02/2008 12:06:00
 
 
À
30/01/2008 04:08:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
01257541
Message ID:
01297446
Vues:
39
>>>>>Probably, that's what Cetin recommended. But wouldn't know how to return the value to ASP.
>>>>
>>>>Here's a SP Example lifted from the web:
>>>>** sp_insert
>>>>PARAMETERS value
>>>>SET NULL OFF
>>>>INSERT INTO table1 (field1) VALUES (m.value)
>>>>CREATE CURSOR result (result i)
>>>>INSERT INTO result VALUES (GetAutoincValue())
>>>>RETURN SETRESULTSET("result")
>>>>
>>>
>>>AFAIK you don't need it as a resultset and may return it as an output parameter. Should work the same, I think.
>>
>>Naomi and Viv
>>Both of you (and Cetin) have been very patient and kind on this issue. Thanks. I find my problems are not so much with VFP but with my unfamiliarity with ASP and how to structure its commands. ASsuming I wrote a SP that RETURNED the value I need, how would you call it from ASP and capture the value? Is this it?
>>
>>x = oConn.Execute("EXEC 'do myStoredProc'")
>
>Just:
>x = oConn.Execute('myStoredProc')
>or, if your SP takes parameters something like:
>x = oConn.Execute('myStoredProc("AStringValue")')
>
>The return value will always be an ADODB.RecordSet. If your SP returns a single value you can grab it from the first column of the first row :
>x.Fields(0).Value
>An example of iterating a Recordset in ASP here:http://fox.wikis.com/wc.dll?Wiki~VFPOleDBProvider~VFP
>Details on the Recordset here:http://technet.microsoft.com/en-us/library/ms681510(VS.85).aspx
>
>
>HTH,
>Viv

Hi Viv -
I'm still messing around with this issue. I've created a stored proc as:
function testsp
return "It worked"
endfunc
and I have an ASP call as
< %
x = oConn.execute(testsp)
% >
This produces a type mismatch error. If I put '' around the testsp I get a syntax error. Any thoughts?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform