For Each r As Row In t.Rows
GH=r("工号")
XM=r("姓名")
Try
Connections("salaryMS").BeginTransaction() '开始事务
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "Insert Into {报盘记录} ([工号],[姓名]) Values ('" & GH & "','" & XM & "')"
cmd.ExecuteNonQuery
Connections("salaryMS").Commit '提交事务,所有操作生效
Catch ex As Exception '如果出错
Connections("salaryMS").Rollback() '回滚事务,撤销所有操作
End Try
Next