Dim dtf As DataTable
Dim dtz As DataTable
Dim day As String
day=format(e.Form.Controls("DateTimePicker1").value,"yyyy-MM-dd")
Dim cmd1 As new SQLCommand
cmd1.C
cmd1.CommandText="select 客户名称, 销售时间 from {赊账明细} where 销账=0 and 销售时间>='" & day & " 00:00:00" & "' and 销售时间<='" & day & " 23:59:59" &"'"
dtf=cmd1.ExecuteReader
Dim cmd2 As new SQLCommand
cmd2.C
cmd2.CommandText="select 名称,数量,单位,零售价,零售金额,销售时间,客户名称 from {赊账明细} where 销账=0 and 销售时间>='" & day & " 00:00:00" & "' and 销售时间<='" & day & " 23:59:59" &"'"
dtz=cmd2.ExecuteReader
Dim DataCols1(1) As DataCol
Dim DataCols2(1) As DataCol
DataCols1(0) = dtf.DataCols("客户名称")
DataCols1(1) = dtf.DataCols("销售时间")
DataCols2(0) = dtz.DataCols("客户名称")
DataCols2(1) = dtz.DataCols("销售时间")
Relations.Add("po", DataCols1, DataCols2,RelationPathEnum.one)
出现如下错误
.NET Framework 版本:2.0.50727.6421
Foxtable 版本:2014.10.23.1
错误所在事件:窗口,销售单,Button1,Click
详细错误信息:
如果父列或子列不在 DataSet 中,则无法创建 DataRelation。