此主题相关图片如下:窗口和表.jpg
查找按钮的Click代码:
Dim dr,dr1 As DataRow
dr = DataTables("预约拍照B表").Find("[儿童姓名] = '" & e.Form.Controls("儿童姓名1").value & "'")
dr1 = DataTables("预约拍照B表").Find("[电话] = '" & e.Form.Controls("电话1").value & "'")
If dr IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
e.Form.Controls("性别1").value = dr("性别")
e.Form.Controls("电话1").value = dr("电话")
e.Form.Controls("年龄1").value = dr("年龄")
e.Form.Controls("客户类别1").value = dr("客户类别")
e.Form.Controls("拍摄日期1").value = dr("拍摄日期")
e.Form.Controls("ComboBox2").value = dr("时间")
e.Form.Controls("拍摄场景1").value = dr("拍摄场景")
ElseIf dr1 IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
e.Form.Controls("性别1").value = dr1("性别")
e.Form.Controls("儿童姓名1").value = dr1("儿童姓名")
e.Form.Controls("年龄1").value = dr1("年龄")
e.Form.Controls("客户类别1").value = dr1("客户类别")
e.Form.Controls("拍摄日期1").value = dr1("拍摄日期")
e.Form.Controls("ComboBox2").value = dr1("时间")
e.Form.Controls("拍摄场景1").value = dr1("拍摄场景")
Else
e.Form.Controls("性别1").value = ""
e.Form.Controls("电话1").value = ""
e.Form.Controls("年龄1").value = ""
e.Form.Controls("客户类别1").value = ""
e.Form.Controls("拍摄日期1").value = ""
e.Form.Controls("ComboBox2").value = ""
e.Form.Controls("拍摄场景1").value = ""
e.Form.Controls("儿童姓名1").value = ""
End If
修改按钮的Click代码:
Dim etxm As String = e.Form.Controls("儿童姓名1").Value
Dim xb As String = e.Form.Controls("性别1").Value
Dim nl As String = e.Form.Controls("年龄1").Value
Dim dh As String = e.Form.Controls("电话1").Value
Dim khlb As String = e.Form.Controls("客户类别1").Value
Dim sj As String = e.Form.Controls("ComboBox2").Value
Dim pscj As String = e.Form.Controls("拍摄场景1").Value
Dim psrq As Date = e.Form.Controls("拍摄日期1").Value
Dim dr,dr1 As DataRow
dr1 = DataTables("预约拍照B表").Find("[儿童姓名] = '" & etxm & "' ")
If dr1 Is Nothing Then
dr1("儿童姓名") = etxm
dr1("性别") = xb
dr1("年龄") = nl
dr1("电话") = dh
dr1("客户类别") = khlb
dr1("时间") = sj
dr1("拍摄场景") = pscj
dr1("拍摄日期") = psrq
DataTables("预约拍照B表").Save()
Tables("预约拍照B表").Filter = "[儿童姓名] = '" & etxm & "'"
MessageBox.Show("恭喜你! 修改成功!")
e.Form.Controls("儿童姓名1").Value = ""
e.Form.Controls("性别1").Value = ""
e.Form.Controls("年龄1").Value = ""
e.Form.Controls("电话1").Value = ""
e.Form.Controls("客户类别1").Value = ""
e.Form.Controls("ComboBox2").Value = ""
e.Form.Controls("拍摄场景1").Value = ""
e.Form.Controls("拍摄日期1").Value = ""
End If
问题:点击“修改按钮的时候表中的相应行的数据没有反应”是怎么回事呢???
[此贴子已经被作者于2013-4-21 11:13:45编辑过]