Yazı Font Küçült Yazı Font Büyült

StringBuilder  

StringBuilder metodunu kullanarak Northwind veritabanındaki customers tablosunun CustomerID sütununun gösterimini sağlıyacağız.

Imports System.Data
Imports System.Data.OleDb

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim baglan As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data/Northwind.mdb"))
        baglan.Open()
        Dim da As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM Customers", baglan)
        Dim ds As DataSet
        ds = New System.Data.DataSet()
        da.Fill(ds, "Customers")

        Dim strResults As New StringBuilder

        strResults.Append("< table >")

        For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
            strResults.Append("< tr >")
            strResults.Append("< td >")

            strResults.Append(ds.Tables(0).Rows(i)("CustomerID"))

            strResults.Append("< /td >")

            strResults.Append("< tr >")

        Next

        strResults.Append("< /table >")

        divResults.InnerHtml = strResults.ToString()
    End Sub
End Class

Bir makalenin daha sonuna geldik. Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN