【質問】 ASP.NETスレ 【議論】
■ このスレッドは過去ログ倉庫に格納されています
0209nobodyさん
03/04/11 11:22ID:k144bWHkDBを読み込んでその結果を表で出力したいのですが
ASPのときは Response.Write でタグを出力していたのですが
ASP.NETでaspxファイルと.vbファイルが分かれているため
いまいちどのように組めばいいのか分かりません。
とりあえず下記の様にすれば希望の状態で出力されるのですが
全然スマートでないので、どなたか最適な方法を教えてください。
DataGridはカスタマイズが面倒なので使いたくないんです・・・
● TableList.aspx.vb
Function TableOut() As String
・
・
myCon.Open()
myDa.Fill(ds, "ProductList")
myCon.Close()
TableOut = "<table border=1 width=100 height=100>"
For i = 0 To ds.Tables("ProductList").Rows.Count
TableOut = TableOut & "<TR>"
TableOut = TableOut & "<TD width=20 >" & ds.Tables("ProductList").Rows(i)("productcode") & "</TD>"
TableOut = TableOut & "<TD width=20 >" & ds.Tables("ProductList").Rows(i)("productname") & "</TD>"
TableOut = TableOut & "</TR>"
Next i
TableOut = "</TABLE>"
End Function
● TableList.aspx
<form id="Form1" method="post" runat="server">
<% = TableOut() %>
</form>
■ このスレッドは過去ログ倉庫に格納されています