Saving DateTime in SQLDatabaseMBS to CubeSQL via SQLPreparedStatementMBS

Since I have moved to API 2.0, I have been using DateTime rather than Date for my database calls. All fields in my INSERT have been arriving OK, except DateTime. There is no error message returned, just a NULL value where the DateTime should go in the database. I’m not sure if this affects other databases, but I am writing to CubeSQL at the moment. It is something like this:

[code]Var tempDate As DateTime = DateTime.Now
Var tempSQLPreparedStatementMBS As SQLPreparedStatementMBS
Var db As SQLDatabaseMBS 'assume it connects OK
Var SQLCommand As String = “INSERT INTO Employees (Name, Created) VALUES (:Name, :Created)”

tempSQLPreparedStatementMBS = db.Prepare(tempSQL)
tempSQLPreparedStatementMBS.BindType(“Name”, SQLPreparedStatementMBS.kTypeString)
tempSQLPreparedStatementMBS.BindType(“Created”, SQLPreparedStatementMBS.kTypeDateTime)

tempSQLPreparedStatementMBS.Bind(“Name”,“Joe Bloggs”)
tempSQLPreparedStatementMBS.Bind(“Created”, tempDate)

tempSQLPreparedStatementMBS.ExecuteSQLMT
db.CommitTransaction[/code]

If I use tempDate.SQLDateTime and kTypeString, the Created field inserts the DateTime OK.

Is SQLPreparedStatementMBS.kTypeDateTime supposed to be able to take the new DateTime format?

I think we added DateTime some time back there.
But if it doesn’t work, please try with date to see if it is the DateTime handling.