自己做个判断呀。
Dim Exergue As String = e.Form.Controls("TextBox1").Value Dim r As DataRow = DataTables("表A").Find("年月 = '" & Exergue & "'") If r IsNot Nothing Then MessageBox.Show("表中已存在 " & Exergue,"提示",MessageBoxButtons.Ok,MessageBoxIcon.Information) Return End If Dim Fjs As List(Of String) = DataTables("表A").GetUniqueValues("房间号 Is Not Null", "房间号") For Each Fj As String In Fjs Dim dr1 As DataRow = DataTables("表A").Find("房间号 = '" & Fj & "'","_Identify Desc") Dim dr2 As DataRow = DataTables("表A").AddNew() dr2("年月") = Exergue dr2("房间号") = Fj dr2("上月读数") = dr1("本月读数") Next
|