Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Second try:</p> <p>Here is you configuration from your comments, just for readability:</p> <pre><code>Configuration cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(typeof(Product).Assembly); ISessionFactory sessionFactory = cfg.BuildSessionFactory(); IDbConnection conn = new SqlConnection(@"Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI;"); ISession session = sessionFactory.OpenSession(conn); Product product = (Product)session.Load(typeof(Product), 12); product.Desc = ""; </code></pre> <p>It's clear that NHibernate has the mapping file, it could not have generated the query. </p> <p>It could be that</p> <ul> <li><strong>the database is not there</strong> : you already checked this.</li> <li><strong>the table is not there</strong> : open a sql console (using the same connect string) and copy-paste the sql from the error message into it. Does it work?</li> <li><strong>the connection is not opened</strong> : see bollow</li> </ul> <p>I think that you need to open the connection yourself. Even better you let NHibernate create and manage the connections. </p> <p>Try this:</p> <pre><code>Configuration cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(typeof(Product).Assembly); ISessionFactory sessionFactory = cfg.BuildSessionFactory(); ISession session = sessionFactory.OpenSession(); Product product = (Product)session.Load(typeof(Product), 12); product.Desc = ""; </code></pre> <p>the connectstring goes to the nhibernate.cfg.xml</p> <pre><code>&lt;property name="connection.provider"&gt;NHibernate.Connection.DriverConnectionProvider, NHibernate&lt;/property&gt; &lt;property name="connection.connection_string"&gt; Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI; &lt;/property&gt; &lt;property name="dialect"&gt;NHibernate.Dialect.MsSql2000Dialect&lt;/property&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload