Skip to content

The version of SQL Server in use does not support datatype 'datetime2'. #203

@Firebie

Description

@Firebie
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using BLToolkit.Data;
using BLToolkit.Data.DataProvider;
using BLToolkit.DataAccess;
using BLToolkit.Mapping;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      var connString =
        "Data Source=dbserver;" +
        "User Id=user;" +
        "Password=password;" +
        "Initial Catalog=db" + ";"
        + "Connection Timeout=30;";

      var sql = new Sql2000DataProvider();
      DbManager.AddDataProvider(sql);

      DbManager.AddConnectionString(sql.Name + ".", connString);
      DbManager.DefaultConfiguration = sql.Name + ".";

      using (var db = new DbManager())
      {
        var q = new SqlQuery<Test>();

        var t = new Test {Id = 1, Dt = null};
        q.Update(db, t);
      }
    }
  }

/*
create table test3
(
  id int not null,
  dt datetime,
)
*/
  [TableName("test3")]
  public class Test
  {
    [MapField("id"), PrimaryKey] public int       Id;
    [MapField("dt")]             public DateTime? Dt;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions