如果表是通过sqlcommand或者其它方式动态生成的,用新增的行做SQLInsertFile是不行的,只能用加载出来的行来SQLInsertFile,如
Dim cr As Row = tb.AddNew()
cr("车牌号") = e.Form.Controls("car_code").Text
cr("车辆类型") = e.Form.Controls("car_cat").Text
cr.DataRow.Save()
Dim drs As List(Of DataRow) = DataTables("tb对应的表").AppendLoad("车牌号 = '" & cr("车牌号") & "'" & "其它条件",False)
If drs.Count = 1 Then
Dim dlg As New OpenFileDialog
If dlg.ShowDialog = DialogResult.OK Then
drs(0).SQLInsertFile("图片", dlg.FileName) '插入文件
End If
End If