C# Microsoft Report 使用查询 TableAdapter 创建数据集
C# Microsoft Report Create dataset with query TableAdapter
我正在快速创建报告。我通过从数据库拖放操作在 Visual Studio 中创建了一个数据集。
在 运行 时,我为每个 table 调用对应的 GetDataBy,因为我需要两个参数。我读 https://msdn.microsoft.com/en-us/library/ms171919.aspx
在我填充它的代码中,我使用了以下代码:
Reports.dsInventory inv = new Reports.dsInventory();
dsInventory.inventory_appointmentsDataTable dtAppointment =
new dsInventoryTableAdapters.inventory_appointmentsTableAdapter()
.GetDataBy(PropertyId, AppointmentId);
dsInventoryTableAdapters.inventory_appointmentsTableAdapter taAppointments =
new dsInventoryTableAdapters.inventory_appointmentsTableAdapter();
taAppointments.Fill(inv.inventory_appointments);
我想 inv
被我的查询填满了,但显然不是。如何应用我的过滤器(例如 GetDataBy(PropertyId, AppointmentId)
)并将结果添加到我的 inv
数据集?
提前致谢!
好的,我找到的简单解决方案是
dsInventory.inventory_appointmentsDataTable dtAppointment =
new dsInventoryTableAdapters.inventory_appointmentsTableAdapter()
.GetDataBy(PropertyId, AppointmentId);
inv.Tables["inventory_appointment"].Merge(dtAppointment);
我正在快速创建报告。我通过从数据库拖放操作在 Visual Studio 中创建了一个数据集。
在 运行 时,我为每个 table 调用对应的 GetDataBy,因为我需要两个参数。我读 https://msdn.microsoft.com/en-us/library/ms171919.aspx
在我填充它的代码中,我使用了以下代码:
Reports.dsInventory inv = new Reports.dsInventory();
dsInventory.inventory_appointmentsDataTable dtAppointment =
new dsInventoryTableAdapters.inventory_appointmentsTableAdapter()
.GetDataBy(PropertyId, AppointmentId);
dsInventoryTableAdapters.inventory_appointmentsTableAdapter taAppointments =
new dsInventoryTableAdapters.inventory_appointmentsTableAdapter();
taAppointments.Fill(inv.inventory_appointments);
我想 inv
被我的查询填满了,但显然不是。如何应用我的过滤器(例如 GetDataBy(PropertyId, AppointmentId)
)并将结果添加到我的 inv
数据集?
提前致谢!
好的,我找到的简单解决方案是
dsInventory.inventory_appointmentsDataTable dtAppointment =
new dsInventoryTableAdapters.inventory_appointmentsTableAdapter()
.GetDataBy(PropertyId, AppointmentId);
inv.Tables["inventory_appointment"].Merge(dtAppointment);