何らかの理由で、DataGridView にデータ ソースのテーブルが取り込まれていません。何が間違っているのかわかりません。データセットにはテーブルがあります。
private void BtnViewUncommittedDataClick(object sender, EventArgs e)
{
if (rbtnNewBusiness.Checked)
{
try
{
UpdateGridForNewBusiness();
return;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Logger.LogError(ex.Source, ex.TargetSite.ToString(), ex.Message);
Enabled = true;
return;
}
}
}
private void UpdateGridForNewBusiness()
{
dgvDetail.DataSource = Database.GetNewBusinessDetailJobData();
dgvSummary.DataSource = Database.GetNewBusinessSummaryJobData();
dgvDetailNYD.DataSource = Database.GetNewBusinessDetailJobDataNyd();
dgvSummaryNYD.DataSource = Database.GetNewBusinessSummaryJobDataNyd();
lblDetailRowCountlbl.Text = "";
lblDetailNYDRowCountlbl.Text = "";
lblSummaryRowCountlbl.Text = "";
lblSummaryNYDRowCountlbl.Text = "";
lblDetailRowCountlbl.Text = "New Business Detail - Row Count:";
lblDetailNYDRowCountlbl.Text = "New Business Detail NYD - Row Count:";
lblSummaryRowCountlbl.Text = "New Business Summary - Row Count:";
lblSummaryNYDRowCountlbl.Text = "New Business Summary NYD - Row Count:";
lblDetailRowCount.Text = dgvDetail.Rows.Count.ToString(CultureInfo.InvariantCulture);
lblSummaryRowCount.Text = dgvSummary.Rows.Count.ToString(CultureInfo.InvariantCulture);
lblDetailNYDRowCount.Text = dgvDetailNYD.Rows.Count.ToString(CultureInfo.InvariantCulture);
lblSummaryNYDRowCount.Text = dgvSummaryNYD.Rows.Count.ToString(CultureInfo.InvariantCulture);
}
他のクエリメソッドは同じであるため、最初のクエリメソッドを示しています。
public static DataSet GetNewBusinessDetailJobData()
{
using (var conn = new SqlConnection(Settings.Default.ConnectionString))
{
using (var cmd = new SqlCommand("spGetNewBusinessDetailJobData", conn) {CommandType = CommandType.StoredProcedure})
{
conn.Open();
cmd.ExecuteNonQuery();
using (var da = new SqlDataAdapter(cmd))
{
using (var ds = new DataSet())
{
da.Fill(ds);
return ds;
}
}
}
}
}
繰り返しますが、データはプルされていますが、何らかの理由で DataGridView は変更されません。シンプルにグレーです。