This is an example of something similar that I have to do with Informix...

public class IfxConnectionProvider : DriverConnectionProvider
{
public override IDbConnection GetConnection()
{
var connection = base.GetConnection();
var setLockCommand = connection.CreateCommand();
setLockCommand.CommandText = "set lock mode to wait 10";
setLockCommand.ExecuteNonQuery();
return connection;
}
}

You can probably do the same for SET NOCOUNT.

   Diego


On Mon, Mar 29, 2010 at 04:37, Roger Kratz <[email protected]> wrote:

> I've seen example sending sending stuff like this to the data source in
> every new connection by impl your own IConnectionProvider.
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of Jocke
> Sent: den 29 mars 2010 08:10
> To: nhusers
> Subject: [nhusers] Re: StaleStateException
>
>
> Is it possible to set this in the application via NHibernate, to
> always override the database server setting?
>
>
> On 26 Mar, 15:38, Roger Kratz <[email protected]> wrote:
> > Yes, most probably set nocount has been turned on at your production db.
> >
> >
> >
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]] On
> Behalf Of Jocke
> > Sent: den 26 mars 2010 13:41
> > To: nhusers
> > Subject: [nhusers] StaleStateException
> >
> > Hi,
> >
> > we experience this error in production environment:
> >
> > NHibernate.StaleStateException: Unexpected row count: -1; expected: 1
> >    at
> >
> NHibernate.AdoNet.Expectations.BasicExpectation.VerifyOutcomeNonBatched(Int­32
> > rowCount, IDbCommand statement)
> >    at NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation
> > expectation)
> >
> > The application was launched 2 months ago and have been working fine
> > until recently when this error started to appear. No updates and no
> > inserts can be executed. I beleive that something has been changed in
> > the production environment but can not understand what. We made a test
> > by creating a new database from scratch on the same server but the
> > error is still there. Googling around I found that it might have to do
> > with SET NOCOUNT ON which as I understand it must be set to OFF,
> > right? NHibernate is using sp_executesql for executing the sql in this
> > case. From the sql profiler we see that the sql reaches the server but
> > cant tell if it is executed followed by a rollback or never executed
> > at all.
> >
> > What could possibly be causing this exception?
> >
> > Thanks,
> > Jocke
> >
> > --
> > 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]<nhusers%[email protected]>
> .
> > For more options, visit this group athttp://
> groups.google.com/group/nhusers?hl=en.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
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