Foxtable(狐表)用户栏目专家坐堂 → sql


  共有2328人关注过本帖树形打印复制链接

主题:sql

帅哥哟,离线,有人找我吗?
cuicuibing
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:402 积分:3545 威望:0 精华:0 注册:2014/1/8 17:12:00
sql  发帖心情 Post By:2014/2/18 11:16:00 [只看该作者]

帮忙看看运行后,没有增加记录。

Dim nms() As String = e.Form.Controls("CheckedComboBox1").text.split(","'获得接收用户名

Dim cmd As New SQLCommand

   cmd.ConnectionName = "shenchan"

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

    cmd.CommandText = "Insert Into xinxi (fasong,jieshou,zhuangtai) Values ('" & user.name & "','" & nm & "',0)"

    cmd.ExecuteNonQuery

Next


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2014/2/18 11:23:00 [只看该作者]

看看会不会显示我执行了:
 
Dim nms() As String = e.Form.Controls("CheckedComboBox1").text.split(",") '获得接收用户名
Dim cmd As New SQLCommand
   cmd.ConnectionName = "shenchan"
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
    cmd.CommandText = "Insert Into xinxi (fasong,jieshou,zhuangtai) Values ('" & user.name & "','" & nm & "',0)"
    cmd.ExecuteNonQuery
    MessageBox.Show("我执行了!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Next

 回到顶部