cmd.CommandText = "Select a.* From {库存表} as a JOIN {商品资料} as b ON a.商品代号 = b.商品代号,a.货主代号 = b.货主代号 where a.货主代号 = '"& s2 &"' and a.商品代号 = '"& s1 &"' and DateDiff('d', d.生产日期, GetDate()) >= b.保质期天数 - a.预警天数 and b.保质期天数 >= 1" Dim dt1 As DataTable = cmd.ExecuteReader()