Hi! What I am trying to do is to send and recive messages throuh users.
The sending part works oks, but I am having troubles reciving em.
I want a label to display "Hi, you Have X new messages". The way I have to know that it is a new messaje is the field M_State, when its > 0 then its new.
Here is my code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Session("User") = "" Then Server.Transfer("login2.aspx") Else Label1.Text = "Bienvenido, " & Session("User") & "!" Dim conns As SqlConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("strConn")) Dim consnew As String = "SELECT COUNT (M_State) as M_Aux FROM tblMessa WHERE " & _ "M_State > 0 and M_To = " & "'" & Session("User") & "'" Dim consnew2 As String = "SELECT tblMessa.M_Aux FROM tblMessa" Dim cmd As New SqlCommand(consnew, conns) Dim cmd2 As New SqlCommand(consnew2, conns) 'OPEN CONNECTION If conns.State = ConnectionState.Closed Then ' IF DB IS NOT OPEN, THEN OPEN IT conns.Open() cmd.ExecuteNonQuery() cmd2.ExecuteNonQuery() HyperLink1.Text = "You have " & cmd2.ExecuteNonQuery & " new messages" 'CLOSE THE CONNECTION conns.Close() End If End If End Sub
Its a SQL Server 2000 connection, thats working fine, the only problem is that when I execute it sayd that the M_Aux field is not valid.
Thanks!