sql server - Error - There is no row at position 0 C# -


when debug project, error:

there no row @ position 0

enter image description here

code error in return (byte[]) ...

public static byte[] baixararquivo(long codarquivo)         {             database db = databasefactory.createdatabase();             dbcommandwrapper dbcommandwrapper = db.getstoredproccommandwrapper("gerrel_arquivo_baixar");             dbcommandwrapper.addinparameter("@codarquivo" , dbtype.int32 , codarquivo);              >>>> return (byte[]) db.executedataset(dbcommandwrapper).tables[0].rows[0]["arquivo"];         } 

i checked database , found no problems. might happening?

=====

private void page_load (object sender, system.eventargs e) { string codigoarquivo = request.querystring ["codarquivo"]; response.binarywrite (bo.arquivo.baixararquivo (int.parse (codigoarquivo)));  } 

enter image description here

executedataset seems return dataset contains table empty. have check if it's correct no rows returned stored-procedure.

if it's possible check rows.count:

var ds = db.executedataset(dbcommandwrapper); if(ds.tables[0].rows.count == 0)      return null; else     return (byte[]) ds.tables[0].rows[0]["arquivo"]; 

otherwise have fix sql in sp.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -