I don't know if this is a bug in Nhibernate 3.2,
I was using OleDbProvider to access Sqlserver via Nhiberanate

the code is like this
            ISessionFactory sessionFactory = (new
Configuration()).Configure().BuildSessionFactory();
            ISession session = sessionFactory.OpenSession(new
MyInterceptor());
            IQuery q = session.CreateQuery("from Customer c where
c.CustomerID=?")
                .SetString(0,"aaa");
            IList<Customer> c = q.List<Customer>();

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
  <session-factory>
    <property
name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
    <property
name="connection.driver_class">NHibernate.Driver.OleDbDriver</
property>
    <property name="connection.connection_string">Provider=SQLOLEDB.
1;Data Source=XXXXXX;Initial Catalog=XXXXX;User ID=sa;Password=XXXXX</
property>
    <property name="show_sql">true</property>
    <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</
property>
    <mapping assembly="NHibernetDemo.Model"/>
  </session-factory>
</hibernate-configuration>


the error message is

Test 'NHibernateTEST.TEST.GetCustomerList' failed:
NHibernate.Exceptions.GenericADOException : could not execute query
[ select customer0_.intID as intID0_, customer0_.CustomerID as
CustomerID0_, customer0_.CustomerName as Customer3_0_ from
T_MyCustomer customer0_ where customer0_.CustomerID=? ]
Positional parameters:  #0>aaa
[SQL: select customer0_.intID as intID0_, customer0_.CustomerID as
CustomerID0_, customer0_.CustomerName as Customer3_0_ from
T_MyCustomer customer0_ where customer0_.CustomerID=?]
  ----> System.IndexOutOfRangeException : Invalid index 0 for this
OleDbParameterCollection with Count=0.

But it is working fine on SaveOrUpdate() function, is this a bug on
Nhibernate or there is something wrong with my code? Please help me!

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to