任何提示如何关闭DataReader
?我使用 postgresql,而 MARS 仅适用于 SQL。或者也许我不需要 MARS 来解决这个我不知道的问题。错误显示在 foreach 循环中。谢谢你的提示。
var months = (from month in connector.PositionInstance where month.FeeNoticeMonth >= DateTime.Now.Month select month);
foreach (PositionInstance p in months)
{
System.Windows.MessageBox.Show("" + p.First().Position.Name);
}
编辑:我有两个表 PositionInstance 和 Position:
CREATE TABLE "Position"
(
"PositionId" integer NOT NULL DEFAULT,
"Name" character varying(30) NOT NULL,
CONSTRAINT "PK_Position" PRIMARY KEY ("PositionId")
)
CREATE TABLE "PositionInstance"
(
"PositionInstanceId" integer NOT NULL DEFAULT,
"FeeNoticeYear" integer NOT NULL,
"FeeNoticeMonth" integer NOT NULL,
CONSTRAINT "PK_PositionInstance" PRIMARY KEY ("PositionInstanceId"),
CONSTRAINT "FK_Position_PositionInstance" FOREIGN KEY ("PositionId")
REFERENCES "Position" ("PositionId") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)