Problema datarow..There is no row at position 0.

lunedì 30 giugno 2008 - 10.02

mame37 Profilo | Junior Member

Ho un piccolo problemino che riguarda una tabella da visualizzare in una pagina web. mi viene dato questo errore:
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.

Brainkiller Profilo | Guru

>Exception Details: System.IndexOutOfRangeException: There is
>no row at position 0.

Evidentemente nel DataSet non ci sono righe.
L'IF che hai fatto precedentemente evidentemente ha due condizioni errate, quindi passa oltre arriva a questa riga:

DataRow dataRow = this.Operation.Tables[0].Rows[0];

e ti va in errore perchè non ci sono dati.
Prova a fare un:

Console.WriteLine(this.Operations.Tables[0].Rows.Count);

prima di arrivare alla riga dell'errore, e vedrai che restituirà 0.
Ciao

David De Giacomi | Microsoft MVP
http://blogs.dotnethell.it/david/
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5