IndexOutOfRange的錯誤 - 無法找到表0 - 這是我的代碼,它擊中了每條線,並引發錯誤。我應該更新什麼,以便執行?數據集調試錯誤
SqlCommand comnd = new SqlCommand(query, con);
con.Open();
DataSet ds = new DataSet();
StreamWriter strmwr = new StreamWriter(Location);
foreach (DataRow in ds.Tables[0].Rows
您正在實例化一個新的數據集,然後嘗試訪問表[0]?你的數據集在那時是空的。你肯定會得到一個錯誤 –