Re: VFP9, SqlServer and NULL values

2018-06-14 Thread Fernando D. Bozzo
Very nice! Adapter Pattern to the rescue :D 2018-06-14 18:50 GMT+02:00 Stephen Russell : > I don't ever remember writing code like this in FP/VFP: > myDate = createObject("Date") > > That is great that you can, and I bet it would have been easier to pass a > date to another language in a

Re: VFP9, SqlServer and NULL values

2018-06-14 Thread Stephen Russell
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

Re: VFP9, SqlServer and NULL values

2018-06-14 Thread Eric Selje
gt; 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 ordina

Re: VFP9, SqlServer and NULL values

2018-06-14 Thread Stephen Russell
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 On Behalf Of Ted Roche > Sent: 13 J

Re: VFP9, SqlServer and NULL values

2018-06-14 Thread Vince Teachout
On 06/13/18 10:30 AM, Rafael Copquin wrote: cCmd = [insert into mydatabase.dbo.employees(name,dob) values( 'John Doe',NULL) ] sqlexec(nHandle,cCmd) messagbox(message()) What error do you get back? --- This email has been checked for viruses by Avast antivirus software.

RE: VFP9, SqlServer and NULL values

2018-06-14 Thread Dave Crozier
ntil such time as the property in the goods passes to the buyer the seller shall be entitled at any time -Original Message- From: ProFox On Behalf Of Ted Roche Sent: 13 June 2018 18:49 To: profox@leafe.com Subject: Re: VFP9, SqlServer and NULL values NULL means "I don't know&quo

Re: VFP9, SqlServer and NULL values

2018-06-13 Thread Ted Roche
NULL means "I don't know" and <> 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

Re: VFP9, SqlServer and NULL values

2018-06-13 Thread Frank Cazabon
I use TEXT ENDTEXT all the time too, but I moved away from the string substitution provided by <<>>. I would imagine it is failing because you need single quotes around the <> like this: Text to cCmd textmerge noshow flags 2 pretext 15 insert into mydatabase.dbo.employees(name,dob) values

Re: VFP9, SqlServer and NULL values

2018-06-13 Thread Rafael Copquin
Thank you Stephen Very clear and exact Rafael 2018-06-13 11:50 GMT-03:00 Stephen Russell : > In SSMS run this script > CREATE PROCEDURE newEmployee > -- Add the parameters for the stored procedure here > @name varchar(75) > , @dob datetime = null > AS > BEGIN > -- SET NOCOUNT ON added to

Re: VFP9, SqlServer and NULL values

2018-06-13 Thread Rafael Copquin
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

Re: VFP9, SqlServer and NULL values

2018-06-13 Thread Stephen Russell
In SSMS run this script CREATE PROCEDURE newEmployee -- Add the parameters for the stored procedure here @name varchar(75) , @dob datetime = null AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; Insert into Employees

Re: VFP9, SqlServer and NULL values

2018-06-13 Thread Frank Cazabon
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

VFP9, SqlServer and NULL values

2018-06-13 Thread Rafael Copquin
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 '-MM-DD' and send it as a character string. However, if the DOB is empty, the only way VFP