» An ultimate catalog of computer data
Forum posts for driver.exe
What is wrong with this date string? causing: “Unhandled Exception: System.FormatException”
I call my script like this:
>Driver.exe 26268 '01-01-2011' '02-01-2011'
arg 0 : c:ServicesJasperBatchServiceReleaseJasperBatchDriver.exe
arg 1 : 26268
Unhandled Exception: System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
at Program.main(String[] args) in C:ssworkdevfSharpServicesops-ProjectsJasperBatchDriverProgram.fs:line 65
and this is the relavent code:
let mutable argNum = 0
let cmdArgs = System.Environment.GetCommandLineArgs()
for arg in cmdArgs do
match argNum with
| 1 -> pmID <- System.Int32.Parse arg
| 2 -> startDate <- DateTime.ParseExact(arg, 'D', new CultureInfo('en-US'))
| 3 -> endDate <- DateTime.ParseExact(arg, 'D', new CultureInfo('en-US'))
| _ -> ()
printfn 'arg %d : %s' argNum arg
argNum <- argNum + 1
i've also tried this:
for arg in cmdArgs do
match argNum with
| 1 -> pmID <- System.Int32.Parse arg
| 2 -> startDate <- DateTime.ParseExact(arg, 'MM-dd-yyyy', new CultureInfo('en-US'))
| 3 -> endDate <- DateTime.ParseExact(arg, 'MM-dd-yyyy', new CultureInfo('en-US'))
| _ -> ()
printfn 'arg %d : %s' argNum arg
argNum <- argNum + 1
and this:
for arg in cmdArgs do
match argNum with
| 1 -> pmID <- System.Int32.Parse arg
| 2 -> startDate <- DateTime.ParseExact(arg, 'MM/dd/yyyy', new CultureInfo('en-US'))
| 3 -> endDate <- DateTime.ParseExact(arg, 'MM/dd/yyyy', new CultureInfo('en-US'))
| _ -> ()
printfn 'arg %d : %s' argNum arg
argNum <- argNum + 1
the closest it seems I came is by using this:
(startDate).ToString('MM/dd/yyyy')
this however added double-quotes to the output....
View complete forum thread with replies
Other posts related to driver.exe
See Related Forum Messages: Follow the Links Below to View Complete Thread
Unable to access mapped net driver when process created from an windows service program (non…
Inconsistent behavior of web driver with IE9
Linker problem on VS2005 with VC++
What is wrong with this date string? causing: “Unhandled Exception: System.FormatException”
[Solved]*** No rule to make target `module_netcdf_io.o', needed by `driver.exe'. Stop. Error