I believe this question was asked several months back, but i believe my situation is different and the same rules may not apply.
Everytime I execute this method that same error pops up. There is no row at position 0. If I change  to  or ; There is no row at  and etc. Could this mean that my database isnt even connecting? Should I write some kind of if statement to determine to check if the rows are even there?
public bool UpdateOrderToShipped(string order)
orderNumber = order;
string batch = ConfigurationManager.AppSettings["SuccessfulOrderBatch"];
string statement = "UPDATE SOP10100 SET BACHNUMB = '"+ batch +"' WHERE SOPNUMBE = @SOPNUMBE";
SqlCommand comm = new SqlCommand(statement, connectionPCI);
KaplanFTP.errorMsg = "Database error: " + e.Message;
statement = "SELECT SOPTYPE FROM SOP10100 WHERE SOPNUMBE = @SOPNUMBE";
comm.CommandText = statement;
SqlDataAdapter da = new SqlDataAdapter(comm);
DataTable dt = new DataTable();
soptype = dt.Rows["SOPTYPE"].ToString(); //errror here
This is very simple ... it means that no results were returned from your query. You always have to code defensively and check to see if the Rows array has any items in it before trying to index into it. Something like:
if (dt.Rows.Length > 0) soptype = dt.Rows["SOPTYPE"].ToString(); else somethingWentWrong();