⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 avgunitpriceoforderdetails.vb

📁 SQL Server 业已成为最为流行的几大数据库之一
💻 VB
字号:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server


<Serializable()> _
<Microsoft.SqlServer.Server.SqlUserDefinedAggregate(Format.Native)> _
Public Structure AvgUnitPriceOfOrderDetails

    Dim Count As Integer
    Dim tempSumPrice As SqlMoney
    Public Sub Init()
        ' 在此处放置代码
        Count = 0
        tempSumPrice = 0
    End Sub

    Public Sub Accumulate(ByVal value As SqlMoney)
        ' 在此处放置代码

        Count = Count + 1
        tempSumPrice = tempSumPrice + value.Value

    End Sub

    Public Sub Merge(ByVal value as AvgUnitPriceOfOrderDetails)
        ' 在此处放置代码
        Accumulate(value.AvgUnitPrice)
    End Sub

    Public Function Terminate() As SqlMoney
        ' 在此处放置代码
        If Count = 0 Then
            AvgUnitPrice = 0
        Else
            AvgUnitPrice = tempSumPrice / Count
        End If
        Return AvgUnitPrice
    End Function

    ' 这是占位符字段成员
    Private AvgUnitPrice As SqlMoney
End Structure

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -