There is no row at position 0

  • Hi there. Im running a web application locally and getting no errors. However when I run it remotely from time to time I get this this error message:

    there is no row at position 0.

    what are the possible causes of this. Thanks.

  • Please post your code and select statement

  • This error indicates that you are trying to reference the first row of a DataTable (or other storage mechanism), but that object does not contain any rows.  Run your query manually (in Query Analyzer or SSMS) to verify that your query returns the expected results.

    To avoid this error, you might do some checking before referencing a row in your data object.  For example

    if (myDataTable.Rows.Count > 0)

       // Do something

    else

       // Do something else

    hth

    Tim

    Tim Mitchell, Microsoft Data Platform MVP
    Data Warehouse and ETL Consultant
    TimMitchell.net | @Tim_Mitchell | Tyleris.com
    ETL Best Practices

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply