VS2008でASP.NET2.0ページを作成しています。私のPage_Loadメソッドには、次のものがあります。
DataTable table = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter();
using (SqlConnection connection = new SqlConnection(conString)) {
using (SqlCommand command = new SqlCommand(cmdString, connection)) {
adapter.SelectCommand = command;
rowCount = adapter.Fill(table);
}
}
私は何を間違えましたか?
初めてページを実行すると、正常に機能します(Fillは1行を返します)。ページを2回実行(デバッグ)すると、行がゼロになります。同様に、ページが実行されていて、cmdStringが変更されるようにURLのパラメーターの1つを変更すると、行がゼロになります。些細なコード変更を行って再コンパイルを強制すると、ページは再び機能します。