外部数据2个表,users\ xinxi.就是点击发送按钮前,先选择需要发送的人。 选中后,点击发送后,自动在xinxi表中追加记录。
请教问题checkedcombobox1,的值如何从users的name中选择,选中后,如何在xinxi表中追加记录时,
能够得到手机号。
发送按钮的代码。
If Tables("问题汇总").Current.IsNull("收件人") = False Then
MessageBox.Show("不能重复发送信息!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
Dim sjr As String =e.Form.Controls("CheckedComboBox1").text
Dim nms() As String = e.Form.Controls("CheckedComboBox1").text.split(",") '获得接收用户名
Dim bm1 As String = Tables("问题汇总").Current("编号")
Dim cmd As New SQLCommand
cmd.C
Dim dt As Date
cmd.CommandText = "Select GetDate()"
dt = cmd.ExecuteScalar()
dt = dt.Date
Dim cmdd As New SQLCommand
Dim dtt As DataTable
cmdd.C
cmdd.CommandText = "SELECT Name,shouji From {users}"
dtt = cmd.ExecuteReader()
Tables("问题汇总").Current("收件人") = sjr
Tables("问题汇总").Current.Save
For Each nm As String In nms
If nm = "" Then
Return
End If
If nm = User.Name Then
MessageBox.Show("不能给自己发信息!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
Dim dr As DataRow
dr = dtt.Find("name = nm ")
cmd.CommandText = "Insert Into xinxi (fasong,jieshou,neirong,fasongshijian,dianhua,zhuangtai) Values ('" & user.name & "','" & nm & "','编号为:"& bm1 &"的问题,需要您处理','" & dt &" ','" & dr(shouji) &" ',0)"
cmd.ExecuteNonQuery
Next
此主题相关图片如下:qq图片1.jpg