+1 for mapping dates using dtos()
Dave
---------------------------------------------------------------
This communication and the information it contains is intended for the person
or organisation to whom it is addressed. Its contents are confidential and may
be protected in law. If you have received this e-mail in error you must not
copy, distribute or take any action in reliance on it. Unauthorised use,
copying or disclosure of any of it may be unlawful. If you have received this
message in error, please notify us immediately by telephone or email.
Flexipol Packaging Ltd. has taken every reasonable precaution to minimise the
risk of virus transmission through email and therefore any files sent via
e-mail will have been checked for known viruses. However, you are advised to
run your own virus check before opening any
attachments received as Flexipol Packaging Ltd will not in any event accept any
liability whatsoever once an e-mail and/or any attachment is received.
It is the responsibility of the recipient to ensure that they have adequate
virus protection.
Flexipol Packaging Ltd.
Unit 14 Bentwood Road
Carrs
Industrial Estate
Haslingden
Rossendale
Lancashire
BB4 5HH
Tel:01706-222792
Fax: 01706-224683
www.Flexipol.co.uk
---------------------------------------------------------------
Terms & Conditions:
Notwithstanding delivery and the passing of risk in the goods, the property in
the goods shall not pass to the buyer until the seller
Flexipol Packaging Ltd. ("The Company") has received in cash or cleared funds
payment in full of the price of the goods and all other goods agreed to be sold
by the seller to the buyer for which payment is then due. Until such time as
the property in the goods passes to the buyer, the buyer shall hold the goods
as the seller's fiduciary agent and bailee and keep the goods separate from
those of the buyer and third parties and properly stored protected and insured
and identified as the seller's property but shall be entitled to resell or use
the goods in the ordinary course of its business. Until such time as the
property in the goods passes to the buyer the seller shall be entitled at any
time
-----Original Message-----
From: ProFox <[email protected]> On Behalf Of Ted Roche
Sent: 13 June 2018 18:49
To: [email protected]
Subject: Re: VFP9, SqlServer and NULL values
NULL means "I don't know" and <<NULL>> in a textmerge returns nothing.
In my VFP 9, it returned .NULL. as the second argument, which no server would
understand :)
try:
SET NULLDISPLAY TO 'NULL'
before the textmerge.
Also, this might work better if you formatted the date you are inserting using
DTOS and wrapped it in single quotes.
On Wed, Jun 13, 2018 at 1:26 PM, Rafael Copquin <[email protected]>
wrote:
> Thank you. It works well as you suggested but:
>
> cName = 'RAFAEL'
> vDOB = NULL
>
> cCmd = 'insert into mydatabase.dbo.employees(name,dob) values
> (?cName,?vDOB)'
> sqlexec(nHandle,cCmd)
>
> the above works, the below construct does not:
>
>
> Text to cCmd textmerge noshow flags 2 pretext 15
>
> insert into mydatabase.dbo.employees(name,dob) values
> ('<<cName>>',<<vDOB>>)
>
> endtext
>
> sqlexec(nHandle,cCmd)
>
>
> Why?
>
> I use text.. endtext most of the time, especially when the statements
> are very long and occupy several lines.
>
> Character strings are surrounded with '<<>>', numbers are <<>> and
> dates are '<<cDate>>' (dates are converted to the form YYY-MM-DD)
>
> Rafael
>
>
>
> 2018-06-13 11:49 GMT-03:00 Frank Cazabon <[email protected]>:
>
>> Don't pass the dates as strings, use parameters and set the blank
>> date parameter to null prior to sending it:
>>
>> PRIVATE myDate AS Date
>>
>> myDate = DATE()
>>
>> IF EMPTY(m.myDate)
>>
>> m.myDate = NULL
>>
>> ENDIF
>>
>> m.lcSQL = "INSERT INTO myTable (myDateField) VALUES (?m.myDate)"
>>
>>
>> Frank.
>>
>> Frank Cazabon
>>
>>
>> On 13/06/2018 10:30 AM, Rafael Copquin wrote:
>>
>>> I have a SQL Server 2012 Express table with a field called DOB of
>>> type DATE
>>>
>>> The field accepts NULL values and does not have a default value..
>>>
>>> To insert the DOB from VFP I transform it to the form 'YYYY-MM-DD'
>>> and send it as a character string.
>>>
>>> However, if the DOB is empty, the only way VFP inserts the record is
>>> if the empty value is sent as ''
>>> and the DOB field displays '1900-01-01' which is the value inserted.
>>>
>>> I want to insert NULL in the field, not '1900-01-01'
>>>
>>> If I use the SQL Server Management Studio, I can insert the NULL
>>> value directly with this expression:
>>>
>>> insert into mydatabase.dbo.employees(name,dob) values( 'John
>>> Doe',NULL)
>>>
>>> However, this command, from VFP, does not insert the record:
>>>
>>> cCmd = [insert into mydatabase.dbo.employees(name,dob) values(
>>> 'John
>>> Doe',NULL) ]
>>>
>>> sqlexec(nHandle,cCmd)
>>>
>>>
>>> How can I get the field to get the NULL value?
>>>
>>> TIA
>>> Rafael Copquin
>>>
>>>
>>> --- StripMime Report -- processed MIME parts ---
>>> multipart/alternative
>>> text/plain (text body -- kept)
>>> text/html
>>> ---
>>>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/CACW6n4s36=yQhNM-a+58hM=gqtmsxk1qrgxpgni63_+ypwt...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.