It would help to see how you are formatting your startdate variable and it should be in quotes.
Brian Erickson

------------------------------
"Who is John Galt"



------ Original Message ------
From: "John J. Mihaljevic" <[email protected]>
To: [email protected]
Sent: 1/10/2013 9:28:37 PM
Subject: Error executing SQL commands on a SQL table
Hi all,

I'm trying to execute commands on a SQL table from with a VFP 6.0
application. Here's the section of code that's causing me problems:

 cnTransfer=sqlstringconnect(cnstr)

cnTransfer has a value of 1, so the above command and cnstr (my connection
string) are apparently fine.

 if cnTransfer<1
  *
  * Database connection failed. Exit program.
  *
   messagebox("Cannot connect to database.")
   return
 endi

 sqltxt='DELETE FROM DailyProductionFoxPro WHERE proddate>=startdate'
 xstr=sqlprepare(cnTransfer,sqltxt)

 xstr has a value of 1, so the above command is apparently fine.

 xexec=sqlexec(cnTransfer)

 xexec has a value of -1. According to the VFP6 help text: SQLEXEC( )
returns -1 if a connection level error occurs.

 if xexec = -1
  messagebox("Connection error while attempting to delete
records from DailyProductionFoxPro.","Error")
  return
 endi

What am I missing here? How am I getting a good result with
sqlstringconnect(), a good result with sqlprepare(), and a failed result
with sqlexec()?

Any help would be greatly appreciated.

Thanks very much,

John


[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/em18a71197-4176-4fb8-8cc3-42df0c4b3451@pslaptop4
** 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.

Reply via email to