Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Stored Procedure
Message
From
23/07/2010 18:09:05
 
 
To
23/07/2010 17:58:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01473624
Message ID:
01473631
Views:
48
>>I have 3 parameters I am trying to pass to a stored procedure
>>They are date fields in the parameters, not date time.
>>The SP variables are string.
>>
>>Is this the correct syntax in Foxpro 9?
>>I am not getting a cursor to be generated.
>>The SP works when I enter 01/01/2009 and 02/01/2009 in QA
>>
>>ldStartDate={}
>>ldEndDate={}
>>ldStartDate=thisform.startdate.value
>>ldEndDate=thisform.enddate.value
>>
>> lcSQLCMD="exec get_invoices ?ldStartDate,?ldEndDate"
>> SQLEXEC(gnConnect,lcSQLCMD,'jobcost')
>>
>>
>>the parameters in the SP are this
>>
>>Alter PROCEDURE get_invoices
>> @ldStartDate Char(12) = '',
>> @ldEndDate Char(12) = ''
>>AS
>
>Andy,
>Why are you not using date or datetime in your SP to prevent ambigiuties? Anyway if you want them as strings you can have them as strings like that. First decide what does '02/01/2009' mean. Say, if it is Feb 1, 2009 and you have set date to mdy then you could construct the string in VFP like this:
>
>
ldStartDate=thisform.startdate.value
>ldEndDate=thisform.enddate.value
>
>lcStartDate = dtoc(m.ldStartDate)
>lcEndDate  = dtoc(m.ldEndDate)
>lcSQLCMD="exec get_invoices ?m.lcStartDate,?m.lcEndDate"
>SQLEXEC(gnConnect,lcSQLCMD,'jobcost')
>
>PS: It is better to have date/datetimes as date/datetime on both sides instead of doing character conversions.
>Cetin

Thanks

so it should be this?
Alter PROCEDURE get_invoices
@ldStartDate DateTime,
@ldEndDate DateTime
What happens if there is a time in the database but I am only getting the date as a prompt?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform