-- 作者:maningyy
-- 发布时间:2014/4/3 16:18:00
--
Dim dt As DataTable Dim dr,dr1 As DataRow Dim str,str1 As String str1=e.Form.Controls("combobox1").text str=e.Form.Controls("textbox1").text Dim Book As New XLS.Book(str) Dim Sheet As XLS.Sheet = Book.Sheets(str1) Dim Result As DialogResult Result = MessageBox.Show("确定要导入数据吗", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then dt=DataTables("状态查询")
Dim j As Integer
For i As Integer = 1 To Sheet.Rows.Count -1 dr=dt.find("发货单号=\'"& sheet(i,1).value &"\'") If dr Is Nothing Then
dr1=dt.AddNew dr1("发货单号")=sheet(i,1).Value dr1("收件人")=sheet(i,2).value dr1("地址")=sheet(i,3).Value dr1("状态")=sheet(i,4).Value dr1("签收人")=sheet(i,5).Value dr1("签收日期")=sheet(i,6).value dr1("跟踪信息")=sheet(i,7).Value dr1("客户")=sheet(i,8).Value dr1("发货日期")=sheet(i,0).value dr1.save() Else dr("状态")=sheet(i,4).Value dr("签收人")=sheet(i,5).Value dr("签收日期")=sheet(i,6).value dr("跟踪信息")=sheet(i,7).Value dr.save() End If Next msgbox("更新完毕!")
End If
|