![]() |
Ayuda: "There is no row at position 0" con store procedure Hola, es la primera vez que posteo aquí pero soy un lector asiduo de vuestras soluciones. Estoy desarrollando una aplicación Web con .NET, con acceso a un servidor SQL Server mediante procedimientos almacenados, y me he quedado pillado en este punto... Con un procedimiento almacenado busco documentos en mi BBDD, en una tabla con los siguientes campos: Nombre --> nvarchar Fecha --> nvarchar Tipo --> nvarchar Idioma --> nvarchar Documento -->datos binarios , muestro el resultado en un Gridview con opción "Edit" (también tiene Select y Delete). Cuando edito el documento, modifico cualquiera de los campos menos los datos binarios (el documento en sí), mediante un procedimiento almacenado que pego a continuación: ALTER PROCEDURE ChangeDocInfo(@OldID nvarchar(100),@OldType nvarchar(50),@OldDate nvarchar(20),@NewId nvarchar(100),@NewType nvarchar(50),@NewDate nvarchar(20),@NewLanguage nvarchar(20)) AS BEGIN TRANSACTION UPDATE Library SET FundID=@NewID, DocType=@NewType, DocDate=@NewDate, DocLanguage=@NewLanguage WHERE FundID=@OldID AND(datediff(day,CONVERT(varchar,Library.DocDate,1 03),@OldDate)=0) AND (DocType=@OldType) COMMIT TRANSACTION El commit y el begin lo he añadido después, puesto que creo que el error puede ser al hacer el update, que no finalice bien la transacción... Hasta aquí no salta ningún error. Aparece cuando selecciono en el Gridview una fila, para que se descargue el documento. El error no es del Select puesto que si no edito el documento me lo descarga correctamente. Os pego más abajo el resultado de no capturar la exception: "Server Error in '/' Application. There is no row at position 0. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IndexOutOfRangeException: There is no row at position 0. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [IndexOutOfRangeException: There is no row at position 0.] System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) +1943315 System.Data.RBTree`1.get_Item(Int32 index) +17 System.Data.DataRowCollection.get_Item(Int32 index) +11 Apeiron.HedgeLab.BBDDFINDFILE.GridView2_SelectedIn dexChanged(Object sender, EventArgs e) +835 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.WebControls.GridView.OnSelectedIndex Changed(EventArgs e) +105 System.Web.UI.WebControls.GridView.HandleSelect(In t32 rowIndex) +89 System.Web.UI.WebControls.GridView.HandleEvent(Eve ntArgs e, Boolean causesValidation, String validationGroup) +221 System.Web.UI.WebControls.GridView.RaisePostBackEv ent(String eventArgument) +199 System.Web.UI.WebControls.GridView.System.Web.UI.I PostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +177 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746" A ver si alguien me puede echar una manilla... Muchas gracias! |
| La zona horaria es GMT -6. Ahora son las 11:45. |
Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.