我的MsSQL是设置的Windows身份验证。这个连接代码应该怎么样写呢。求高手指导。
原来看到的:
<property name="connection.connection_string">
    Server=.\SQLExpress;Datebase=NHCookbook;Trused_Connection=SSPI
</property>
可是调试的时候无法插入数据到MsSQL 我的是MsSQL2008.谢谢

解决方案 »

  1.   

    可以在配置文件
    hibernate.cfg.xml  <!-- properties -->
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
      <property name="connection.connection_string">Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI</property>
    配置还可以写在.config文件中 <nhibernate>
      <add key="hibernate.connection.provider"          
       value="NHibernate.Connection.DriverConnectionProvider" 
      />
      <add key="hibernate.dialect"                      
       value="NHibernate.Dialect.MsSql2000Dialect" 
      />
      <add key="hibernate.connection.driver_class"          
       value="NHibernate.Driver.SqlClientDriver" 
      />
      <add key="hibernate.connection.connection_string" 
       value="Server=localhost;initial catalog=test;user=sa;password=" 
      />
     </nhibernate>具体参考http://www.cnblogs.com/me-sa/articles/524162.html