Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Update record
Message
 
 
To
16/10/2001 22:44:23
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00569376
Message ID:
00569381
Views:
21
This message has been marked as the solution to the initial question of the thread.
Hi Mike,

There's an article 'ADO Jumpstart for Microsoft Visual FoxPro Developers' by John Petersen at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfoxgen/html/adojump.asp. In particular it shows how to check for errors in ADO because they don't trigger VFP errors.

See my comments and corrections below

>How do you code an sql update and execute it via SQL Passthrough or ADO. Im having problems in particular with date fields on how to insert Null to the date field if the value is empty . The code is shown below. When executing this code, it does not prompt for an error but it does not update the table.
>If Empty(Entrydate)
>    cEntrydate = <b>"NULL"</b>

In SQl Server NULL constant doesn't have surrounding dots and it has to be a constatnt not string "NULL"

>Else
>    cEntrydate = <b>["] + Ttoc(Entrydate) + ["]</b>
>Endif
>	
>cSQL = [UPDATE bbfs!callinv SET  callername = "]+ ALLTRIM(.callername)  +[",] +;
       [ callerlocation = "]+ ALLTRIM(.callerlocation) +[",] +;
       [ entrydate = ] +	<b>cEntrydate</b>  +;
        [ WHERE callrefno = ] + Alltrim(Str(cCallrefno))
>
>This.oConn.Execute(cSQL)		
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform