plusone3055
asked on
VBSCRIPT Returning value 1.6.40 as 1/6/1940
this vb script is returning the value in the column as dates and it shouldn't
im using the line 34
objRecordset.Open " SELECT ACT_ID, FORMAT([INTRO_DATE],'mm/dd /yyyy') as [INTRO_DATE] FROM " & objFile.Name, objConnection
and my textpad is returning 1/6/1940 01/07/2010 01/07/2010
when it should be returning 1.6.40 01/07/2010 01/07/2010
the date format for the date has to remain becuase it is needed for the next phase of the application. and without it the dates do not return correctly.
Attached is the script
sample data
and result
can be execute by command
cscript Script.vbs sample.csv 1.txt
Thank you in advance
sample.csv
Script.vbs
1.txt
im using the line 34
objRecordset.Open " SELECT ACT_ID, FORMAT([INTRO_DATE],'mm/dd
and my textpad is returning 1/6/1940 01/07/2010 01/07/2010
when it should be returning 1.6.40 01/07/2010 01/07/2010
the date format for the date has to remain becuase it is needed for the next phase of the application. and without it the dates do not return correctly.
Attached is the script
sample data
and result
can be execute by command
cscript Script.vbs sample.csv 1.txt
Thank you in advance
sample.csv
Script.vbs
1.txt
ASKER
got the error expected end of statment
ASKER
i copied and pasted everything into a blank
script.vbs and got
Script.vbs(39,5) VbScript Runtime error Subscript Out of range [Number: 0]
script.vbs and got
Script.vbs(39,5) VbScript Runtime error Subscript Out of range [Number: 0]
Are you using a different sample file than the one you posted? I get no errors...
ASKER
no sir I am using the same smaple file
I am launching it in via .BAT File
cscript Script.vbs sample.csv 1.txt
I am launching it in via .BAT File
cscript Script.vbs sample.csv 1.txt
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
the ACT_ID is correct but the INTRO_DATE is now incorrect
im getting back
1.6.40 6/20/2011 6/20/2011
1.3.40 6/20/2011 6/20/2011
1.4.40 6/20/2011 6/20/2011
1.10.40 6/20/2011 6/20/2011
1.60.401 6/20/2011 6/20/2011
Needs to be
1.6.40 06/20/2011 06/20/2011
1.3.40 06/20/2011 06/20/2011
1.4.40 06/20/2011 06/20/2011
1.10.40 06/20/2011 06/20/2011
1.60.401 06/20/2011 06/20/2011
date needs to be mm/dd/yyyy
becuase the application its importing into only takes mm/dd/yyyy format it
im getting back
1.6.40 6/20/2011 6/20/2011
1.3.40 6/20/2011 6/20/2011
1.4.40 6/20/2011 6/20/2011
1.10.40 6/20/2011 6/20/2011
1.60.401 6/20/2011 6/20/2011
Needs to be
1.6.40 06/20/2011 06/20/2011
1.3.40 06/20/2011 06/20/2011
1.4.40 06/20/2011 06/20/2011
1.10.40 06/20/2011 06/20/2011
1.60.401 06/20/2011 06/20/2011
date needs to be mm/dd/yyyy
becuase the application its importing into only takes mm/dd/yyyy format it
ASKER
I got it
made both fields
adVarChar, MaxCharacters
Thanks so much for your help :)
made both fields
adVarChar, MaxCharacters
Thanks so much for your help :)
Glad you got it working - thanks for the grade! :^)
Open in new window