功能强大的组件。我这里主要介绍一下
asp.net 端的代码:


1

2

3


4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

app_code 的类


Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Collections.Generic
Namespace xxxx
''' <summary>
''' Represents a product and methods for
''' working with products
''' </summary>
Public Class xxxxClass
Private Shared ReadOnly _connectionString As String
Private _id As Integer
Private _manynumber As Integer
Private _dizhi As String
Private _youbian As String
Private _jiage1 As Decimal
Private _jiage2 As Decimal
Private _number As String
Public Property Id() As Integer
Get
Return _id
End Get
Set(ByVal Value As Integer)
_id = Value
End Set
End Property
Public Property dizhi() As String
Get
Return _dizhi
End Get
Set(ByVal Value As String)
_dizhi = Value
End Set
End Property
Public Property Number() As String
Get
Return _number
End Get
Set(ByVal Value As String)
_number = Value
End Set
End Property
Public Property youbian() As String
Get
Return _youbian
End Get
Set(ByVal Value As String)
_youbian = Value
End Set
End Property
Public Property jiage1() As Decimal
Get
Return _jiage1
End Get
Set(ByVal Value As Decimal)
_jiage1 = Value
End Set
End Property
Public Property jiage2() As Decimal
Get
Return _jiag2
End Get
Set(ByVal Value As Decimal)
_jiage2 = Value
End Set
End Property
''' <summary>
''' Select all products in a particular category
''' </summary>
'''
Public Shared Function SelectCustomerId(ByVal CustomerID As Integer) As List(Of xxxxClass)
' Initialize command
Dim con As New SqlConnection(_connectionString)
Dim cmd As New SqlCommand("xxxxxSelectByCustomerId", con)
cmd.CommandType = CommandType.StoredProcedure
' Add parameters
cmd.Parameters.AddWithValue("@CustomerID", CustomerID)
Dim results As New List(Of PropertyClass)()
Using con
con.Open()
Dim reader As SqlDataReader = cmd.ExecuteReader()
While reader.Read()
results.Add(New xxxxClass(reader))
End While
End Using
Return results
End Function
''' <summary>
''' Initializes a product from a DataReader
''' </summary>
Public Sub New(ByVal reader As SqlDataReader)
_id = CType(reader("CustomerID"), Integer)
_dizhi= CType(reader("dizhi"), String)
_youbian= CType(reader("youbian"), String)
_jiage1= CType(reader("jiage1"), Decimal)
_jiage2= CType(reader("jiage2"), Decimal)
_manynumber = CType(reader("manynumber "), Integer)
End Sub
''' <summary>
''' Retrieve database connection string from Web configuration
''' </summary>
Shared Sub New()
_connectionString = "data source=sdd,user name=xxx, password=xxxx"
End Sub
End Class
End Namespace
这些代码是 帮助理解, 做个小测试。