Afficher un tableau a partir de données contenu dans un Datareader
Bon j'espere que l'intitulé du problème est explicite...
J'ai effectuer ma requete sur ma table.
Je souhaiterais juste les faire afficher dans un tableau.
J'ai bien essayé plusieurs choses, mais véritablement , je suis totalement pommé par rapport au PHP...
Voici mon code
Citation:
Dim sSql As String = "select count(*) from machin"
Dim oConn As New SqlConnection(ConfigurationSettings.GetConfig("appSettings")("ConnString"))
Dim oComm As New SqlCommand(sSql)
oComm.Connection = oConn
oConn.Open()
''On récupére les informations du count
Dim iResultat As Integer = oComm.ExecuteScalar()
Dim dr As SqlDataReader = oComm.ExecuteReader()
Dim monString As String
TextBox1.Text = iResultat '' test compter nb d'enregistrement
TextBox2.Text = dr.FieldCount '' test compter nb colonne
'' création du tableau
MonTableau.Width = "100%"
MonTableau.CellPadding = "1"
MonTableau.CellSpacing = "0"
MonTableau.Border = "2"
Dim colonne As Integer, ligne As Integer
For ligne = 0 To iResultat
Dim Maligne As New HtmlTableRow
For colonne = 0 To dr.FieldCount
Dim MaCase As New HtmlTableCell
MaCase.Width = "10%"
MaCase.InnerHtml = dr((colonne)).ToString
Maligne.Cells.Add(MaCase)
Next
MonTableau.Rows.Add(Maligne)
Next
:( :( :( :(