六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

改寫(xiě)即時(shí)消息的發(fā)送,包含一起給多人發(fā)送信息!

[摘要]以前的的發(fā)送消息按鈕事件改寫(xiě)如下: '/////////////////////轉(zhuǎn)到發(fā)送即時(shí)消息頁(yè)面 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Han...
   以前的的發(fā)送消息按鈕事件改寫(xiě)如下:
  '/////////////////////轉(zhuǎn)到發(fā)送即時(shí)消息頁(yè)面
   Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
   Dim i, j As Integer
   j = 0
   Dim tostu_id As String = ""
   For i = 0 To mycheck.Items.Count - 1
   If mycheck.Items(i).Selected Then
   '////////////////////////限制發(fā)送條數(shù)
   j = j + 1
   If j < 6 Then
   '/////////////////////參數(shù)構(gòu)造
   tostu_id = tostu_id & CheckBoxList1.Items(i).Text & "@"
   Else
   Label2.Visible = True
   Label2.Text = "一次最多能給五個(gè)用戶發(fā)送信息!"
   Return
   'Response.Write("<script language=JavaScript>window.open('info.aspx?tostu_id=' & CheckBoxList1.Items(i).Text,'','height=330,width=560,status=no,location=no,toolbar=no,directories=no,menubar=no')</script>")
   End If
   End If
   Next i
   Response.Redirect("info.aspx?tostu_id=" & tostu_id)
   End Sub
  
  
  
  這里發(fā)送信息的頁(yè)面由于修改的比較多,所以把全部代碼全都抓來(lái)了,呵呵:)
  codebebind部分:
  Imports System.Data
  Imports System.Data.SqlClient
  Public Class info
   Inherits System.Web.UI.Page
   Protected WithEvents Label1 As System.Web.UI.WebControls.Label
   Protected WithEvents Label2 As System.Web.UI.WebControls.Label
   Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
   Protected WithEvents Button1 As System.Web.UI.WebControls.Button
   Protected WithEvents Button2 As System.Web.UI.WebControls.Button
   Protected WithEvents Label3 As System.Web.UI.WebControls.Label
   Protected WithEvents Label4 As System.Web.UI.WebControls.Label
   Protected WithEvents Label5 As System.Web.UI.WebControls.Label
   Protected WithEvents Label6 As System.Web.UI.WebControls.Label
   Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox
   Protected WithEvents Image3 As System.Web.UI.WebControls.Image
   Protected WithEvents Label8 As System.Web.UI.WebControls.Label
   Protected WithEvents Label7 As System.Web.UI.WebControls.Label
   Protected WithEvents Label9 As System.Web.UI.WebControls.Label
   Protected WithEvents Label10 As System.Web.UI.WebControls.Label
   Protected WithEvents Button3 As System.Web.UI.WebControls.Button
   Protected WithEvents Label11 As System.Web.UI.WebControls.Label
   Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
  
  #Region " Web Form Designer Generated Code "
  
   'This call is required by the Web Form Designer.
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  
   End Sub
  
   Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
   'CODEGEN: This method call is required by the Web Form Designer
   'Do not modify it using the code editor.
   InitializeComponent()
   End Sub
  
  #End Region
   Dim conn As SqlConnection = New SqlConnection("server=lixinri;uid=sa;pwd=;database=99re1")
   Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   If Not IsPostBack Then
   Dim tostu_id As String = Request.QueryString("tostu_id")
   Dim splitname() As String
  '///////////這里用了Split函數(shù)將傳過(guò)來(lái)的參數(shù)取出
   splitname = Split(tostu_id, "@")
   If tostu_id = "" Then
   '//////////////////當(dāng)回復(fù)留言時(shí)
   Dim sql As String = "select a.*,b.nick from info a,pwd b where a.fromstu_id=b.stu_id and a.tostu_id='" & Session("stu_id") & "' and a.term=1"
   Dim comm As SqlCommand = New SqlCommand(sql, conn)
   Dim dr As SqlDataReader
   conn.Open()
   dr = comm.ExecuteReader
   While dr.Read
   Label3.Text = dr.Item("nick")
   Label4.Text = dr.Item("tim")
   Label5.Text = "    " & dr.Item("content")
   TextBox1.Text = dr.Item("nick")
   TextBox3.Text = dr.Item("fromstu_id")
   TextBox1.Enabled = False
   Label8.Visible = False
   Label11.Visible = False
   End While
   dr.Close()
   comm.Cancel()
   '//////////////////////更新留言使留言屬性為已閱讀過(guò)
   Dim sql_1 As String = "update info set term=0 where tostu_id='" & Session("stu_id") & "' and term=1 and tim='" & Label4.Text & "'"
   comm = New SqlCommand(sql_1, conn)
   comm.ExecuteNonQuery()
   Else
   '////////////////////當(dāng)發(fā)送留言時(shí)
   '/////////////////讀取參數(shù)
   Dim i As Integer
   For i = 0 To UBound(splitname) - 1
   Dim mysql As String = "select nick from pwd where stu_id='" & splitname(i) & "'"
   Dim comm As SqlCommand = New SqlCommand(mysql, conn)
   Dim dr As SqlDataReader
   If i = 0 Then
   conn.Open()
   dr = comm.ExecuteReader
   If dr.Read Then
   TextBox1.Text = Trim(dr.item("nick")) & ";"
   End If
   control()
   dr.close()
   Else
   dr = comm.ExecuteReader
   If dr.Read Then
   TextBox1.Text = TextBox1.Text & Trim(dr.item("nick")) & ";"
   End If
   control()
   dr.close()
   End If
   Next i
   End If
   End If
   End Sub
   '/////////////////control事件,沒(méi)有什么實(shí)際意義,使代碼簡(jiǎn)單罷了。
   Sub control()
   TextBox1.Enabled = False : Label3.Text = "" : Label4.Text = "" : Label5.Visible = False
   Label8.Visible = True : Label6.Visible = False : Label7.Visible = False : Label9.Visible = False
   Button3.Visible = False : Label11.Visible = True
   Label11.Text = "<a href=board.aspx><<<返回學(xué)友錄</a>"
   End Sub
  
   '/////////////////書(shū)寫(xiě)提交消息事件
   Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
   Dim tostu_id As String = Request.QueryString("tostu_id")
   Dim splitname() As String
   splitname = Split(tostu_id, "@")
   If tostu_id = "" Then
   '/////////////////////////當(dāng)回復(fù)留言時(shí)
   If TextBox2.Text = "" Or TextBox2.Text = " " Then
   Label10.Visible = True
   Label10.Text = "消息不能為空!"
   Return
   Else
   Label10.Visible = False
   conn.Open()
   Dim sql As String = "insert into info(fromstu_id,tostu_id,content,term,tim) values(@fromstu_id,@tostu_id,@content,@term,@tim)"
   Dim comm As SqlCommand = New SqlCommand(sql, conn)
   comm.Parameters.Add(New SqlParameter("@fromstu_id", SqlDbType.Int, 4))
   comm.Parameters("@fromstu_id").Value = Session("stu_id")
  
   comm.Parameters.Add(New SqlParameter("@tostu_id", SqlDbType.Int, 4))
   comm.Parameters("@tostu_id").Value = TextBox3.Text
  
   comm.Parameters.Add(New SqlParameter("@content", SqlDbType.VarChar, 200))
   comm.Parameters("@content").Value = TextBox2.Text
  
   comm.Parameters.Add(New SqlParameter("@term", SqlDbType.Int, 4))
   comm.Parameters("@term").Value = "1"
  
   comm.Parameters.Add(New SqlParameter("@tim", SqlDbType.Char, 20))
   comm.Parameters("@tim").Value = Date.Now
   comm.ExecuteNonQuery()
   'TextBox2.Text = ""
   End If
   Else
   '/////////////////////////當(dāng)發(fā)送留言時(shí)
   If TextBox2.Text = "" Or TextBox2.Text = " " Then
   Label10.Visible = True
   Label10.Text = "消息不能為空!"
   Return
   Else
   '////////////////插入i條數(shù)據(jù)
   Dim i As Integer
   For i = 0 To UBound(splitname) - 1
   Label10.Visible = False
   If i = 0 Then
   conn.Open()
   Else
   End If
   Dim sql As String = "insert into info(fromstu_id,tostu_id,content,term,tim) values(@fromstu_id,@tostu_id,@content,@term,@tim)"
   Dim comm As SqlCommand = New SqlCommand(sql, conn)
   comm.Parameters.Add(New SqlParameter("@fromstu_id", SqlDbType.Int, 4))
   comm.Parameters("@fromstu_id").Value = Session("stu_id")
  
   comm.Parameters.Add(New SqlParameter("@tostu_id", SqlDbType.Int, 4))
   comm.Parameters("@tostu_id").Value = splitname(i)
  
   comm.Parameters.Add(New SqlParameter("@content", SqlDbType.VarChar, 200))
   comm.Parameters("@content").Value = TextBox2.Text
  
   comm.Parameters.Add(New SqlParameter("@term", SqlDbType.Int, 4))
   comm.Parameters("@term").Value = "1"
  
   comm.Parameters.Add(New SqlParameter("@tim", SqlDbType.Char, 20))
   comm.Parameters("@tim").Value = Date.Now
   comm.ExecuteNonQuery()
   'TextBox2.Text = ""
   Next i
   End If
   End If
   Response.Write("<script language=javascript>alert('發(fā)送成功!')</script>")
   End Sub
  
   '////////////////////返回繼續(xù)發(fā)送
   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
   Response.Redirect("boaman.aspx")
   End Sub
  
   Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
   Response.Write("<script language=javascript>window.close()</script>")
   End Sub
  End Class
  
  
  感謝laodeng了:)



主站蜘蛛池模板: 午夜在线播放免费人成无 | 在线观看 a国v | 亚洲欧美日本韩国综合在线观看 | 色一欲一性一乱一区二区三区 | 中文有码中文字幕免费视频 | 亚洲www网站| 丝袜美女啪啪 | 中文字幕高清免费不卡视频 | 最新国语露脸精品国产 | 深夜福利影院在线观看 | 日本a级三级三级三级久久 日本a级片在线播放 | 亚洲国产日韩在线观看 | 色婷婷在线观看视频 | 天堂avav | 星辰影院在线观看高清免费观看 | 亚洲视频欧洲视频 | 三级国产在线 | 人人揉揉揉人人捏人人看 | 日韩精品成人 | 天天色一色 | 一本大道香蕉久97在线视频 | 欧美无人区码卡二三卡四卡 | 伊人影视在线观看日韩区 | 欧美综合亚洲图片综合区 | 日本在线观看一级高清片 | 日韩午夜激情视频 | 天天操天天射天天插 | 婷婷色爱区综合五月激情韩国 | 午夜私人影院粉色视频我要 | 宅男午夜视频在线观看 | 午夜精品久久久久久久99热 | 一级做a爰片久久毛片16 | 特级一级毛片免费看 | 欧美一区福利 | 午夜视频成人 | 亚洲福利一区二区精品秒拍 | 亚洲二区视频 | 欧美在线 在线播放 | 五月婷婷六月综合 | 色日韩在线 | 午夜久久久久久网站 |