Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP datetime used as parameter for SPT to SQL Server Pro
Message
 
 
À
02/02/2001 11:18:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00471561
Message ID:
00471811
Vues:
24
FYI, I personally have not had a problem passing any type of variable into a SP using the ?myvariable method. I pass datetimes all the time with the following syntax:
ttstart and ttEnd are datetime parameters I pass into this VFP function
sqlexec(.nConnectionHandle,'exec MySp ?ttStart, ?ttEnd','c_temp')
The only difference I see is I have an EXEC on the front of my SP call.

>Thanks Luis Maria Guayan, Vlad Grynchsyshyn, Larry Miller and Daniel LeClair. It is now absolutely clear what the problem was.
>
>1) I cannot pass datetimes directly -- apparently this type of parmeter passing requires strings. (I'll experiment briefly to see if this applies to integer,float and other number types as well -- but I gather from the posts that it does.)
>
>2) If I use a special formmating for the string (curly braces plus a type indicator) called an escape clause I can make the parameter passing driver independent. Although this particular problem turned out to be a UFU on my part rather than a driver problem, this is still very good know, and should probably become a standard practice on my part.
>
>Again thanks to all.
>
>
>>I have a stored procedure in SQL Server 7 that incluses a select statement along the lines of SELECT * FROM table WHERE date_add >= @bdate and date_add <= @edate. @bdate and @edate are datetime parmaters to this procedure.
>>
>>The following SPT works fine:
>>
>>ln_return=SQLEXEC(ln_handle, "myproc '01/01/2001','01/01/2001'")
>>*Note yes I should give it better strings -- but for teting purposes these work
>>*fine.
>>*ln_return=1
>>*And I do indeed get one sqlresult cursor
>>
>>*This following fails
>>ln_bdate=datetime()
>>ln_edate=datetime()
>>ln_return=SQLEXEC(ln_handle, "myproc ?d1,?d2")
>>*ln_return = -1 meaning an error
>>* and of course I get no results cursors
>>* Is this an ODBC problem? A UFU on my part? Help!
>>*
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform