These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: error on getting rows from view
PostPosted: Tue Oct 20, 2009 6:42 am 
Newbie

Joined: Sun Jan 27, 2008 4:26 pm
Posts: 18
Hi,

i am getting error when getting rows from view.

error is:- NHibernate.AdoNet.TooManyRowsAffectedException: Unexpected row count: 2; expected: 1

this view has got 3 triggers. these trigger have specified set nocount on as very first statement.Even though set nocount specified i am getting this error. I am fed up with this error. Could yiu please tell ehy i am getting this error, whats the solution for this. I have been struggling with error since 2 days.

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: error on getting rows from view
PostPosted: Tue Oct 20, 2009 8:40 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Is it possible that the view returns more than one row for an id ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: error on getting rows from view
PostPosted: Tue Oct 20, 2009 8:46 am 
Newbie

Joined: Sun Jan 27, 2008 4:26 pm
Posts: 18
No, one id returns one row only.


Top
 Profile  
 
 Post subject: Re: error on getting rows from view
PostPosted: Tue Oct 20, 2009 8:57 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Hm, try the SQL Profiler and check what statement hibernate sends to the server and what is returned.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: error on getting rows from view
PostPosted: Tue Oct 20, 2009 9:12 am 
Newbie

Joined: Sun Jan 27, 2008 4:26 pm
Posts: 18
i am trying to get all rows from view to display in gridview.. i am getting this error :- NHibernate.AdoNet.TooManyRowsAffectedException: Unexpected row count: 2; expected: 1.

View would not return more than one row for an id.

i do not know how to check sql profiler. what is SQL profiler. In what cases we do get above error?

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: error on getting rows from view
PostPosted: Tue Oct 20, 2009 9:24 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Sorry, I can't give you answers to your problem, I can just give you help to find the reason. I know that this can happen with triggers and insert/update, but never heard of problems during select.

SQL Profiler is a tool that comes with SQL server (not the express edition). You can monitor the statements that are send to the server. If you don't have the profiler installed, you can start with setting NHibernate logging to DEBUG and add hibernate.show_sql="true" to the configuration. Maybe you find something helpful in the log.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: error on getting rows from view
PostPosted: Tue Oct 20, 2009 10:07 am 
Newbie

Joined: Sun Jan 27, 2008 4:26 pm
Posts: 18
Hi,

Thank you for your help. I have SQL profiler, i checked in that. My view contains 2 rows fro one id. Thats why its giving me error. I removed one row and its working fine.

Thanks & Regards
Sandy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.