This is a migrated thread and some comments may be shown as answers.

Failed in called stored procedure

5 Answers 88 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
FISCAL
Top achievements
Rank 1
FISCAL asked on 01 Jul 2011, 02:31 PM
Hi,

I have upgraded my OA ORM to latest version "2011.1.411.2". The application compiles fine but when running it fails resulting following stack trace -

at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e) at Telerik.OpenAccess.RT.ExceptionWrapper.Throw() at OpenAccessRuntime.storagemanager.logging.LoggingStorageManager.fetchNextQueryResult(ApplicationContext context, RunningQuery runningQuery, Int32 skipAmount) at OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.getNextQueryResult(QueryResultWrapper aQrs, Int32 skipAmount) at OpenAccessRuntime.DataObjects.ForwardQueryResult.Initialize(Int32 indexParam) at OpenAccessRuntime.DataObjects.ForwardQueryResult.get_Item(Int32 indexParam) at Telerik.OpenAccess.RT.ListEnumerator.setCurrent(Int32 _pos) at Telerik.OpenAccess.RT.ListEnumerator.Move(Int32 relative) at Telerik.OpenAccess.RT.ListEnumerator.MoveNext() at Telerik.OpenAccess.RT.QueryResultImpl.ToList() at Telerik.OpenAccess.RT.ObjectScope.ExecuteStoredProcedure[T](String procedureName, IEnumerable`1 parameterDefinition, Object[] parameterValues) at Telerik.OpenAccess.OpenAccessContextBase.ExecuteStoredProcedure[T](String procedureName, IEnumerable`1 parameterDefinition, Object[] parameterValues) at APForensicsDataRepository.APForensicsDbContext.DPFRptVendorAnalysis(String reportNameIDs, Nullable`1 dateFrom, Nullable`1 dateTo, Nullable`1 invDateOrEnteredDate, Nullable`1 sECOrganisationID, Nullable`1 returnRecords, String sortBy) in D:\APForensics\trunk\APForensicsDataRepository\EntityDiagrams.cs:line 2339 at APForensicsDataRepository.InvoiceAnalysis.ManagementInfoReportRepository.GetVendorAnalysisRecords(Nullable`1 orgID, String reportNameIDs, Char invDateOrEnteredDate, Nullable`1 dateFrom, Nullable`1 dateTo, String sortBy, Int32 returnRecords) in D:\APForensics\trunk\APForensicsDataRepository\InvoiceAnalysis\ManagementInfoReportRepository.cs:line 325 at IsisWebApp.WebUI.Reports.InvoiceAnalysis.frmSupplierAnalysisReport.btnDisplayReport_Click(Object sender, EventArgs e) in D:\APForensics\trunk\APForensicsWebApp\WebUI\Reports\InvoiceAnalysis\frmSupplierAnalysisReport.aspx.cs:line 354


Could you please let me know why it is failing when the old version was working fiine? The new thing I noticed is that stored procedure parameter of type NVARCHAR(1) is converted to persistent class Char.


Many thanks.

MG


5 Answers, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 07 Jul 2011, 06:13 PM
Hello Milan,

 Is there an inner exception available? Can you provide the call stack for that exception?
Also can you provide the stored procedure defintion, in particular the type of each parameter of the stored procedure and the call to context.ExecuteStoredProcedure. This would help in narrowing down to the exact cause of the exception.

Looking forward to resolving this issue.

Kind regards,
Ady
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
FISCAL
Top achievements
Rank 1
answered on 12 Jul 2011, 01:32 PM
HI Ady,

For the time being, I have changed to NVARCHAR(2) where there was problem. You could easily try at your end to generate persistent classes based on stored procedure taking parameter of data type nvarchar(1).

E.g

Create procedure spTest
    (
    @fName NVARCHAR(20),
    @middleName nvarchar(1)
    )
    as    
BEGIN
    select * from myTable where firstname = @fName and middleName like '@middleName%'
 END

Thx.
MG
0
Ady
Telerik team
answered on 15 Jul 2011, 10:59 AM
Hi Milan,

 I was able to reproduce the exception and we will fix this. Your Telerik points have been updated.

All the best,
Ady
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ken
Top achievements
Rank 1
answered on 08 Aug 2011, 08:06 PM
I'm also having a stored procedure issue. My problem is a stored procedure runs for about 6 minutes, then throws an exception. I tried changing the ConnectionTimeout, but it still throws the exception. Here's my stack trace

Query failed: System.InvalidOperationException: Invalid attempt to call VisibleFieldCount when reader is closed.
   at System.Data.SqlClient.SqlDataReader.get_VisibleFieldCount()
   at OpenAccessRuntime.Relational.query.RelationalCompiledQuery.CreateMappingInfo(ResultSet rs, ClassMetaData cmd, String filter, RelationalMappingResolver rmr)
   at OpenAccessRuntime.Relational.query.RelationalCompiledQuery.getMappingInfo(ResultSet rs)
   at OpenAccessRuntime.Relational.RelationalQueryResult.createFetchResult(Connection conParam, SqlDriver sqlDriver, Boolean scrollableParam, FetchSpec fetchSpec, RelationalCompiledQuery relationalCompiledQuery, RelationalStorageManager storageManager, QueryParameters parameters, Int32 fetchSize, Int32 maxRows)
   at OpenAccessRuntime.Relational.RelationalQueryResult.executeActual() System.InvalidOperationException: Invalid attempt to call VisibleFieldCount when reader is closed.
   at System.Data.SqlClient.SqlDataReader.get_VisibleFieldCount()
   at OpenAccessRuntime.Relational.query.RelationalCompiledQuery.CreateMappingInfo(ResultSet rs, ClassMetaData cmd, String filter, RelationalMappingResolver rmr)
   at OpenAccessRuntime.Relational.query.RelationalCompiledQuery.getMappingInfo(ResultSet rs)
   at OpenAccessRuntime.Relational.RelationalQueryResult.createFetchResult(Connection conParam, SqlDriver sqlDriver, Boolean scrollableParam, FetchSpec fetchSpec, RelationalCompiledQuery relationalCompiledQuery, RelationalStorageManager storageManager, QueryParameters parameters, Int32 fetchSize, Int32 maxRows)
   at OpenAccessRuntime.Relational.RelationalQueryResult.executeActual()
0
Ady
Telerik team
answered on 11 Aug 2011, 04:23 PM
Hi Ken,

Is this exception consistently reproducible or does it happen only sometimes? What is the value for the 'Active connection timeout' configuration property? Can you test executing the stored procedure by turning of the OpenAccess managed connection pool? You can do this by specifying the <mediumTrust>True</mediumTrust> entry in the app.config file, in the backendconfiguration section. You can also set it via the 'Backend configuration settings' dialog.


Greetings,
Ady
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
Development (API, general questions)
Asked by
FISCAL
Top achievements
Rank 1
Answers by
Ady
Telerik team
FISCAL
Top achievements
Rank 1
Ken
Top achievements
Rank 1
Share this question
or