我新建一个窗口,
里面放有: DataList1绑定数据表“表A” DataList2
在DataList1的CurrentChanged事件中: Dim cmd As New SQLCommand cmd.C Dim dst1 As WinForm.DataList = e.Form.Controls("DataList1") Dim dst2 As WinForm.DataList = e.Form.Controls("DataList2") if dst1.count>0 then Dim dr1 as DataRow = dst1.Current '获得选定行 dim str as string = dr1("商品编码") cmd.CommandText = "select * from product where u_Code = '" & str & "'" end if dst2.DataTable = cmd.ExecuteReader() dst2.Build() 能够正常执行。以上的目的:选择DataList1每一行,能够查询关联表。
但DataList1不能像Table1那样能编辑查询的方便。所以我想将DataList1换成Table1,就是代码要在那里写才好
|