Binde data til en Rpeater i en Execute.Reader
Sidder og er gået i stå med følgende:Har en reader og alt efter resultat fra, vil jeg gerne koble til en ny command, hvor resultat bindes til en Repeater.
Kode følger:
Dim strSQL As String
Dim strSQLCount As String
strSQL = "SELECT id from Tabel1 WHERE Aktiv = 1"
Command = New System.Data.SqlClient.SqlCommand(strSQL, Connection)
Connection.Open()
Reader = Command.ExecuteReader()
If Reader.Read = True Then
Do
strSQLCount = "SELECT COUNT(Name2) As AntalName1 FROM Tabel2 WHERE ID = " & Reader.GetValue(0)
Command = New System.Data.SqlClient.SqlCommand(strSQLCount)
CType(Repeater2.FindControl("lbl2"), Label).Text = Reader("AntalName1").ToString
strSQLCount = "SELECT COUNT(Name3) As AntalName2 FROM Tabel3 WHERE ID = " & Reader.GetValue(0)
Command = New System.Data.SqlClient.SqlCommand(strSQLCount)
CType(Repeater2.FindControl("lbl2"), Label).Text = Reader("AntalName2").ToString
Loop While Reader.Read
Else
End If
Reader.Close()
Connection.Close()
???:-) karsten_larsen