Free Support Forum -

Problem Writing Date Fields to SQL 2005

Writes to the date fail when I issue prj.write(). When I look at the database trace I can see the # that are used to contain objects are translated into ''. That is two single quotes. So a date field in a SQL statement woukd look similar to this ''12/12/2006''. If I remove one quote from the end and one from the start of this string I can run the sql statement. I have tried a number of things with setttng quotes identifiers on and off. Any thoughts anyone?

Probably there is something with settings of SQL server or oledb/odbc.
Aspose.Tasks uses standard System.Data.OleDb namespace to get access to sql server.
And there are no any quotes in the statements at all. All dates are set through Parameters.

If you look at start or finish date in a debugger you will see they are surrounded by pound signs. When they are written to a SQL database those pound signs get converted. This is a known problem going back to the 90's when mixing Jet and SQL Server. I just don't don't know what to do here with Aspose.

Both sides of each of the following statements show the #'s in a debugger. The write causes an error. If I trap this in a sql trace and run the statement again there is an error. If I remove the one of the qutoes from each side of the date fields the sql statement works.

prj.Project.FinishDate = mppLoaded.Project.FinishDate

prj.Project.StartDate = mppLoaded.Project.StartDate