Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 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: Date time
smriti
Posts: 3
 
Date timeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Jul 07 9:13 AM
I am trying to pass date in Query but i get error like cannot convert varchar to date.
strSQL = "StoreProc '1','HOME','1436.N.Fairmount','Wichita', 'KS','67208', '" & CDate(01/01/2007) & "' "
Can you please suggest me how to do this.
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Date timeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Jul 07 10:19 AM
Change the date before hand to text, and then pass the text in a variable (instead of as a function)
[Reply][Quote]
Guy Barrett
Posts: 63
 
Re: Date timeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Jul 07 5:57 AM
I have written a small utility that rearranges dates into an SQL useable format...

function RearrangeDate(theDATE) as String

RearrangeDate = ""

if theDATE <> "" then
RearrangeDate = Month(theDATE) & "/" & Day(theDATE) & "/" & Year(theDATE)
else
RearrangeDate = ""
End if

end function

As such you can pass a date object directly to it and it will return a string that is useable in SQL. With your code from above you should be able to call it with...

strSQL = "StoreProc '1','HOME','1436.N.Fairmount','Wichita', 'KS','67208', '" & RearrangeDate(Now) & "' "

Which should work for 'todays' date.

I might have the wrong end of the stick with what you are trying to achieve, but give it a go.
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Date timeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Jul 07 3:05 PM
I dont use SPROCS with SLX, but I think your problem is much simpler than that - you need to put your date within quotes for the CDATE function: CDATE("01/01/2007").

Timmus
[Reply][Quote]
Jeff Weight
Posts: 219
 
Re: Date timeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 07 8:32 AM
The quotation marks recommendation may have done it, but I think it may be even simpler than that - just don't use the CDate function - pass the date directly in. If you are grabbing a date from a variable, you can do what I do, which is use the "FormatDateTime(theDateVariable, 2)" function.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Date timeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Sep 07 12:59 AM
Quote:
Originally posted by smriti

I am trying to pass date in Query but i get error like cannot convert varchar to date.
strSQL = "StoreProc '1','HOME','1436.N.Fairmount','Wichita', 'KS','67208', '" & CDate(01/01/2007) & "' "
Can you please suggest me how to do this.


I know I am late on the game on this one, but did you all notice that the code above is placing single quotes around the result from CDate?
That means that strSQL probably looked something like this:
"StoreProc '1','HOME','1436.N.Fairmount','Wichita', 'KS','67208', '254545' "
Which probably wasn't what was needed, I think that all that was needed here was to get rid of CDate so that strSQL resulted in:
"StoreProc '1','HOME','1436.N.Fairmount','Wichita', 'KS','67208', '01/01/2007' "

Again, I know I am late to the game here, but I didn't want to let it pass unnoticed
[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/26/2024 4:12:29 AM