proper way to instantiate command parameter mapped to Date on server
Posted: Mon 28 Jan 2013 21:30
I am trying to troubleshoot possible causes for empty DataReader (field-names but zero rows) when executing a function that returns TABLE, reported here:
http://forums.devart.com/viewtopic.php?f=3&t=25754
I know the function is working because it works with npgsql provider.
One possibility is that the Date value is being passed to the server incorrectly. If the function on the server wants a Date (not a Timestamp) what is the proper way to create the command parameter and assign its value using Devart dotConnect? Are there any localization issues involved?
Do I simply assign a string?
PgSqlCommand.Parameters["mydate"].PgSqlValue = "2013-01-28";
Or cast the string to a custom DevArt type not recognized in .NET CLR?
//hypothetically:
PgSqlCommand.Parameters["mydate"].PgSqlValue = (PgSqlDataTypes.Date) "2013-01-28";
Or assign a DateTime value?
PgSqlCommand.Parameters["mydate"].PgSqlValue = DateTime.Parse("2013-01-28 00:00:00");
Thanks
http://forums.devart.com/viewtopic.php?f=3&t=25754
I know the function is working because it works with npgsql provider.
One possibility is that the Date value is being passed to the server incorrectly. If the function on the server wants a Date (not a Timestamp) what is the proper way to create the command parameter and assign its value using Devart dotConnect? Are there any localization issues involved?
Do I simply assign a string?
PgSqlCommand.Parameters["mydate"].PgSqlValue = "2013-01-28";
Or cast the string to a custom DevArt type not recognized in .NET CLR?
//hypothetically:
PgSqlCommand.Parameters["mydate"].PgSqlValue = (PgSqlDataTypes.Date) "2013-01-28";
Or assign a DateTime value?
PgSqlCommand.Parameters["mydate"].PgSqlValue = DateTime.Parse("2013-01-28 00:00:00");
Thanks