i am making member to member message inbox.
i am confuse of some reason please solve it.
i am also using View (marge 4 tables) but main table this so I am sending SQL column name. my problem is in repeter only one show record.
is member A sending message member B and member C sending message to member B so only will show member A message.
ProfileID : nvarchar(50)
SenderID : nvarchar(50)
userblock : nvarchar(10)
iconmsg: nvarchar(30)
status : nvarchar(10)
senderdate : nvarchar(50)
MatchID : nvarchar(50)
SELECT dbo.Tbl_Personalinfo.ProfileID, dbo.Tbl_Personalinfo.Username, dbo.Tbl_Personalinfo.mstatus, dbo.Tbl_Personalinfo.age, dbo.Tbl_Personalinfo.face, dbo.Tbl_userimage.userimage, dbo.Tbl_userimage.premission,
dbo.Tbl_address.prescity, dbo.Tbl_address.presprovince, dbo.Tbl_address.prescountry, dbo.Tbl_messageinbox.MatchID, dbo.Tbl_messageinbox.sendermsg, dbo.Tbl_messageinbox.replymsg,
dbo.Tbl_messageinbox.msgstatus, dbo.Tbl_messageinbox.replystatus, dbo.Tbl_messageinbox.userblock, dbo.Tbl_messageinbox.status, dbo.Tbl_messageinbox.senderdate, dbo.Tbl_messageinbox.SenderID,
dbo.Tbl_messageinbox.ProfileID AS Expr1
FROM dbo.Tbl_Personalinfo INNER JOIN
dbo.Tbl_userimage ON dbo.Tbl_Personalinfo.ProfileID = dbo.Tbl_userimage.ProfileID INNER JOIN
dbo.Tbl_address ON dbo.Tbl_Personalinfo.ProfileID = dbo.Tbl_address.ProfileID INNER JOIN
dbo.Tbl_messageinbox ON dbo.Tbl_Personalinfo.ProfileID = dbo.Tbl_messageinbox.SenderID
Private Sub messageinbox_Load(sender As Object, e As EventArgs) Handles Me.Load
ProfileIDlbl = Session("login").ToString()
inboxmessages()
End Sub
Private Sub inboxmessages()
Dim constr As String = ConfigurationManager.ConnectionStrings("Constring").ConnectionString
Using con As SqlConnection = New SqlConnection(constr)
Dim Myreader As SqlDataReader
If con.State = ConnectionState.Closed Then
con.Open()
End If
Dim Query = "select * from Vw_messagesender where ProfileID='" + ProfileIDlbl + "'"
Dim cmd2 As New SqlCommand(Query, con)
'Dim Myreader As SqlDataReader
Dim Ds As New DataSet
Dim Da As New SqlDataAdapter
Da = New SqlDataAdapter(Query, con)
Ds = New DataSet
Da.Fill(Ds)
If Ds.Tables(0).Rows.Count > 0 Then
Myreader = cmd2.ExecuteReader
Myreader.Read()
matchidlbl = Myreader("SenderID")
con.Close()
End If
Using cmd As SqlCommand = New SqlCommand("SELECT * from Vw_messagesender where (ProfileId='" + ProfileIDlbl + "' and SenderID='" + matchidlbl + "') ", con)
Using sda As SqlDataAdapter = New SqlDataAdapter(cmd)
Using dt As DataTable = New DataTable()
sda.Fill(dt)
inboxrepeater.DataSource = dt
inboxrepeater.DataBind()
For Each item As RepeaterItem In inboxrepeater.Items
Dim img As HtmlImage = TryCast(item.FindControl("userimage"), HtmlImage)
Dim imagestatus As HiddenField = TryCast(item.FindControl("imginboxpremission"), HiddenField)
If imagestatus.Value = "Hide" Then
img.Src = "images/maniconlock.png"
End If
Next
End Using
End Using
End Using
End Using
End Sub