想从外部数据源的基础数据表“产品编码”中提取数据填充其他列(未加载表),有以下几咱方式
方式一、
Dim nms() As String = {"类别","品名","规格","图号","产品来源","计量单位"}
Dim cmd As New SQLCommand '从后台产品编码表取数填充
Dim dt As DataTable
cmd.ConnectionName = Mydata
cmd.CommandText = "SELECT 产品编码,类别,品名,规格,图号,产品来源,计量单位 From {产品编码} where [产品编码] = '" & e.DataRow("产品编码") & "'"
dt = cmd.ExecuteReader()
If dt.DataRows.count > 0 Then
Dim dr As DataRow = dt.DataRows(0)
For Each nm As String In nms
e.DataRow(nm) = dr(nm)
Next
End If
方式二、(2014版)
Dim nms() As String = {"类别","品名","规格","图号","产品来源","计量单位"}
Dim drs As List(of DataRow)
drs = DataTables("订单").SQLSelect("产品编码 =
'" & e.DataRow("产品编码") & "'
")
dim dr As DataRow = drs(0)
For Each nm As String In nms
e.DataRow(nm) = dr(nm)
Next
请问上述两种方式哪种快?
如果有SQLFind就好了,直接从后台查找到一行数据出来就行,那样是否更快?
谢谢!