Dim perName As String = e.Form.Controls("perName").Value
Dim cardId As String = e.Form.Controls("cardId").Value
Dim famName As String = e.Form.Controls("FamName").Value
Dim famTel As String = e.Form.Controls("FamTeL").Value
Dim guanXi As String = e.Form.Controls("guanXi").Value
Dim political As String = e.Form.Controls("FamPolitical").Value
Dim age As String = e.Form.Controls("FamAge").Value
Dim famJob As String = e.Form.Controls("FamJob").Value
Dim famAddr As String = e.Form.Controls("FamAddr").Value
''清空控件上的值 (这样貌似没有清空?)
e.Form.Controls("FamName").Value=""
e.Form.Controls("FamTeL").Value=""
e.Form.Controls("guanXi").Value=""
e.Form.Controls("FamPolitical").Value=""
e.Form.Controls("FamAge").Value=""
e.Form.Controls("FamJob").Value=""
e.Form.Controls("FamAddr").Value=""
Dim cmd As New SQLCommand
cmd.C
If famName= "" Then
Messagebox.show("请输入姓名!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
If guanXi = "" Then
Messagebox.show("请输入关系!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
cmd.CommandText = "Insert Into {family} ([cardId],[huzhu],[name],[guanxi],[age],[political],[tel],[job],[address]) Values ('"
cmd.CommandText = cmd.CommandText & cardId & "','" & perName & "','" & famName & "','" & guanXi & "','" & age & "','" & political & "','" & famTel & "','" & famJob & "','" & famAddr & "')"
If cmd.ExecuteNonQuery = 1 Then '返回1表示增加成功
Messagebox.show("添加成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
''只加载当前新增用户的家人信息(这样加载的表格是空的)
Dim Filter As String
With e.Form.Controls("cardId")
If .Value IsNot Nothing Then
Filter = "cardId = '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("family").Filter = Filter
End If
End If
老师,您帮我看看红色部分那个代码哈,我觉得逻辑是对的,但是没有实现我的功能?