Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - ADO General
Forum to discuss ADO specific questions for use with SalesLogix. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to ADO General | New ThreadView:  Search:  
 Author  Thread: update existing record
Michael Rogers
Posts: 70
 
update existing recordYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Dec 08 9:42 AM
Greetings all,

I am using .addnew to insert a record with 98 fields into a custom table (managed form.) Now, rather than having the .open sql "where 1 = 2", I'm opening the recordset "where tableid = 'xxxxxxxxxxxx'". I am changing the fields("xxxx").value, then trying to use .update to update the table.

Am I doing this wrong? I tried to copy the format from the Tickets Activities Support script, but getting no errors and no table updates.

Michael
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: update existing recordYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Dec 08 3:11 AM
That won't work if you didn't actually find a row (i.e. there was nothing there). You'd have to issue a .AddNew first. You can do this by checking .RecordCount (as you won't want this .AddNew if the row is found).
[Reply][Quote]
Michael Rogers
Posts: 70
 
Re: update existing recordYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Dec 08 8:19 AM
Mike, thanks for the response. I figured out what was going on last night: it wasn't an ADO issue as much as an anomoly of the date edit control.
When I selected a date using the calander (control set to ddddd, DB field is Date), the update saved my change. If I typed "1/1/2009", the ADO .Update failed to save my change, but threw no error. To prevent this I am returning key = 0 for the key press event of these controls now.

The control isn't bound, and I am setting the fields("xxxxx").vqalue = dtemydate.datetime. If I try to set it equal to the .text property, ADO won't update.

Perhaps off-topic, but does anyone know how to force the date edit control to store 12:00:00, rather than current time if I have it configured as Date?

Michael
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: update existing recordYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Dec 08 7:13 AM
Quote:
Originally posted by Michael Rogers

....

Perhaps off-topic, but does anyone know how to force the date edit control to store 12:00:00, rather than current time if I have it configured as Date?

Michael


You have run accross a "bug" that's been in the dte control since SP1 for 6.0 (which was when the control was added to SalesLogix).
We created a function way back then (and still use it in every situation where dte is configured "date only") to deal with this problem. There's also a problem when you want "time only".

Here's a link to a bundle that has the "fix" for both problems. It includes typical usage info (tie to the OnPopupReturn event of the dte control(s).

www.rjlSystems.net/TheToolBoxX/Misc/DTE_Control_Fix.zip

--
RJLedger - www.SlxWizard.com
rjlSystems
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: update existing recordYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Dec 08 11:00 AM
you want the DATEONLY date time to store DATEVALUE(NOW()) & "00:00:05" otherwise you'll run into GMT/UTC conversion issues with SLX.

the 05 tells the provider NOT TO GMT CONVERT.
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: update existing recordYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Dec 08 8:53 PM
Quote:
Originally posted by RJ Samp

you want the DATEONLY date time to store DATEVALUE(NOW()) & "00:00:05" otherwise you'll run into GMT/UTC conversion issues with SLX.

the 05 tells the provider NOT TO GMT CONVERT.


That's only related to "timeless" "Z" types and is not supposed to be used. If it's setup via teh dbmanager asa date Only it will not do a GMT/UTC conversion.
--
RJLedger - www.SlxWizard.com
rjlSystems
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: update existing recordYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Dec 08 9:33 PM
I have ZERO Date fields in any Database in SLX for the last 11 years.....any/all versions.

When a DateTime field is , in actuality, a date only.....I've been using DATEVALUE(datetime) & " 00:00:05 " and all is fine......

How should we store a Date to Opportunity.DateOpened? Why doesn't SLX have this as a Date Field, why is it DateTime?

[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: update existing recordYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Dec 08 10:07 PM
Quote:
.....

Perhaps off-topic, but does anyone know how to force the date edit control to store 12:00:00, rather than current time if I have it configured as Date?

Michael


There is a brutal way of forcing it, as exemplified in the following UPDATE statement (using Opportunity.EstimatedClose as an example)

update opportunity
set estimatedclose = dateadd(hh, 12, cast(floor(cast(estimatedclose as real)) as datetime))

You could easily build something like this into your code.

Phil
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: update existing recordYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Dec 08 8:37 AM
Quote:
Originally posted by Phil Parkin



There is a brutal way of forcing it, as exemplified in the following UPDATE statement (using Opportunity.EstimatedClose as an example)

update opportunity
set estimatedclose = dateadd(hh, 12, cast(floor(cast(estimatedclose as real)) as datetime))

You could easily build something like this into your code.

Phil


Here's a link to a bundle that has a couple of basic functions to do what you want to do. You use these in the OnExit event of the DTE control:
www.rjlSystems.net/TheToolBoxX/Misc/DTE_Control_Fix.zip

I wrote these a few years ago and have used them in 100% of the system we customize for our clients.
--
RJLedger - www.SlxWizard.com
rjlSystems
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 11:09:27 AM