Formunuzu Şekil 1 deki oluşturun.
Şekil 3
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
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 dv As DataView
'Customers tablosundaki kayıtları alacağız.
dv = New DataView(ds.Tables("Customers"))
'Tablodan CustomerID sütununda ALFKI olan
'kayıtları göstereceğiz...
dv.RowFilter = "CustomerID = 'ALFKI'"
GridView1.DataSource = dv
GridView1.DataBind()
baglan.Close()
End Sub
End Class
Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
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 dv As DataView
'Customers tablosundaki kayıtları alacağız.
dv = New DataView(ds.Tables("Customers"))
'Tablodan CustomerID sütununda ALFKI olan
'kayıtları göstereceğiz...
dv.RowFilter = "CustomerID = 'ALFKI'"
GridView1.DataSource = dv
GridView1.DataBind()
baglan.Close()
End Sub
End Class
Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN
0 comments:
Yorum Gönder