public void OnAChange(Object sender, EventArgs e) { DataSet a = new DataSet(); DataAdapter c; datacontrol b = (datacontrol)Session["database"]; Driver d = (Driver)Session["driver"]; if (StateList.SelectedItem.Text == "当前合同") { c = b.getContract(); } else if (StateList.SelectedItem.Text == "有效合同") { c = b.getOkContract(); } else if (StateList.SelectedItem.Text == "所有合同") { c = b.getAllContract(); } else { c = null; } try { c.Fill(a); Contractgride.DataSource = a; Contractgride.DataBind(); } catch (System.Data.SQLite.SQLiteException) { Response.Write("<script>alert('没有当前合同');</script>"); } }
public void OnSreach(object sender, EventArgs e) { DataAdapter c; //数据库绑定 DataSet b = new DataSet(); datacontrol a = (datacontrol)Session["database"]; c = a.getContract(); try { c.Fill(b); this.acarGrid.DataSource = b; this.acarGrid.DataBind(); } catch (System.Data.SQLite.SQLiteException) { Response.Write("<script>alert('没有执行合同的车辆');</script>"); } }