Dim yhms As String = e.Form.Controls("用户名").Text '获得接收用户名
Dim nr As String = e.Form.Controls("TextBox2").Text '获得发送内容
If yhm = "" Orelse nr = "" Then
Return
End If
dim i as integer
Dim SQL,s2 As String
Dim cmd As New SQLCommand
cmd.Connection Name = "XXX"
For Each js As String In yhms.Split(",")
if i > 0 Then s2 = vbcrlf & vbcrlf
s2+ = _UserName & " " & Date.Now & vbcrlf & " " & nr
SQL = "Insert Into {内部通讯} ([发送者],[接收者],[发送时间],[发送内容]) Values ('"
SQL = SQL & _UserName & "','" & js & "',#" & Date.Now & "#,'" & nr & "')"
cmd.CommandText = SQL
cmd.ExecuteNonQuery '返回1表示增加成功
i = i+1
Next
if cmd.ExecuteNonQuery = 1 then
e.Form.Controls("TextBox2").Value = ""
e.Form.Controls("TextBox1").Value = s2
End If
[此贴子已经被作者于2015/6/29 14:00:04编辑过]