SqlConnection Con = new SqlConnection(FunComponent.GetConnString());
SqlDataAdapter da;
DataTable dt1 = new DataTable();
string sql = "select FltNo from dtFltDetails where Origin='"+TextBox3.Text.Trim()+"' and Destination='"+TextBox4.Text.Trim()+"'";
da = new SqlDataAdapter(sql,Con);
try
{
Con.Open();
da.Fill(dt1);
for (int j = 0; j < dt1.Rows.Count;j++ )
{
DataTable dt2 = new DataTable();
SqlDataAdapter da1 = new SqlDataAdapter("select * from dtStatus where FltNo='" + dt1.Rows[j]["FltNo"].ToString() + "' and StatusDate='" + DropDownList1.SelectedItem.Value + DropDownList2.SelectedItem.Value + DropDownList3.SelectedItem.Value + "'", Con);
da1.Fill(dt2);
if (dt2.Rows.Count == 0)
{
DataTable dt3=new DataTable();
SqlDataAdapter da2 = new SqlDataAdapter("select FltNo,SeatsExec,SeatsBn from dtFltDetails where Origin='" + TextBox3.Text.Trim() + "'and Destination='" + TextBox4.Text.Trim() + "'", Con);
da2.Fill(dt3);
SqlCommand Com = new SqlCommand("insert into dtStatus(FltNo,StatusDate,ExecStatus,BnStatus) values('" + dt3.Rows[0]["FltNo"].ToString() + "','" + DropDownList1.SelectedItem.Value + DropDownList2.SelectedItem.Value + DropDownList3.SelectedItem.Value + "','" + dt3.Rows[0]["SeatsExec"].ToString() + "','" + dt3.Rows[0]["SeatsBn"].ToString()+"'", Con);
Com.ExecuteNonQuery();
}
}
}
为什么程序到da1.Fill(dt2);就执行不下去了