Professional IronPython


Click Next. You see the Choose Your Database Objects page shown in Figure 17-21. 12



Download 20,35 Mb.
Pdf ko'rish
bet392/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   388   389   390   391   392   393   394   395   ...   453
11.
Click Next. You see the Choose Your Database Objects page shown in Figure 17-21.
12.
Check the Customers table entry, as shown in Figure 17-21. The example relies on the 
Customers table and none of the other database content. Click Finish. The new data source 
appears in the Data Sources window, as shown in Figure 17-22. If you can’t see this window, 
choose Data
➤➤➪➤➤
Show Data Sources.
Adding Database Manipulation Code
After all the work you performed to obtain access to the data, the actual database manipulation 
code is relatively easy. Listing 17-5 shows the small amount of code used to actually retrieve a par-
ticular record from the database based on the 
CustomerID
field. Of course, you can add any level of 
complexity required.
548592c17.indd 381
2/24/10 12:49:39 PM
www.finebook.ir


382

CHAPTER 17
ExtEnding ironPython Using VisUal Basic.nEt
LISTINg 17-5: 
 Retrieving data from the database
Public Function GetData(ByVal Customer As String) As _
NorthwindDataSet.CustomersRow
‘ Obtain access to the table.
Dim MyData As NorthwindDataSetTableAdapters.CustomersTableAdapter = _
New NorthwindDataSetTableAdapters.CustomersTableAdapter()
‘ Create a DataSet.
Dim DS As NorthwindDataSet.CustomersDataTable = _
New NorthwindDataSet.CustomersDataTable()
‘ Fill the DataSet with data.
MyData.Fill(DS)
‘ Find a particular record using the Customer ID.
Return DS.FindByCustomerID(Customer)
End Function
The code begins by creating a 
TableAdapter
object. Because the example relies on the 
Data Source Configuration Wizard, it has a specific 
TableAdapter
to use in the form of the 
NorthwindDataSetTableAdapters.CustomersTableAdapter

MyData
object. 
MyData
provides the 
means to select information from the table. In addition, it can update, delete, and insert records. 
Essentially, 
MyData
is the database connection.
The next step is to create a 
DataTable
object. Again, the example has a specific version, 
NorthwindDataSet.CustomersDataTable
class, 
DS
object. 
DS
contains all the data selected from 
the database through the 
TableAdapter
object.

Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   388   389   390   391   392   393   394   395   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish