?? chunksize.frm
字號:
VERSION 5.00
Begin VB.Form frmChunkSize
Caption = "chunksize"
ClientHeight = 7890
ClientLeft = 60
ClientTop = 345
ClientWidth = 14625
LinkTopic = "Form1"
ScaleHeight = 7890
ScaleWidth = 14625
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton cmdGetImage
Caption = "Display Image"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 10560
TabIndex = 11
Top = 6960
Width = 1575
End
Begin VB.Frame Frame2
Caption = "Result"
BeginProperty Font
Name = "Times New Roman"
Size = 12.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1455
Left = 8400
TabIndex = 8
Top = 4800
Width = 5535
Begin VB.Label lblRoundTrips
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2400
TabIndex = 13
Top = 960
Width = 2175
End
Begin VB.Label lblTimeTaken
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1560
TabIndex = 12
Top = 480
Width = 3735
End
Begin VB.Label Label5
Caption = "No. of Round Trips = "
BeginProperty Font
Name = "Times New Roman"
Size = 12.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 10
Top = 960
Width = 2295
End
Begin VB.Label label
Caption = "Time Taken ="
BeginProperty Font
Name = "Times New Roman"
Size = 12.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 9
Top = 480
Width = 1455
End
End
Begin VB.OptionButton optchunk
Caption = "Chunk Size (in bytes)"
BeginProperty Font
Name = "Times New Roman"
Size = 12.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 8520
TabIndex = 5
Top = 3840
Width = 3135
End
Begin VB.OptionButton optValue
Caption = "Value Property"
BeginProperty Font
Name = "Times New Roman"
Size = 12.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 8520
TabIndex = 4
Top = 3360
Value = -1 'True
Width = 2535
End
Begin VB.ComboBox cboSelectProduct
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 2280
Style = 2 'Dropdown List
TabIndex = 0
Top = 1680
Width = 3255
End
Begin VB.Frame Frame1
Caption = "Chunk Size"
BeginProperty Font
Name = "Times New Roman"
Size = 12.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1455
Left = 8400
TabIndex = 6
Top = 3000
Width = 5535
Begin VB.TextBox txtChunkSize
Enabled = 0 'False
Height = 375
Left = 3840
TabIndex = 7
Text = "100"
Top = 840
Width = 1575
End
End
Begin VB.Label Label2
Caption = "Update Product Image"
BeginProperty Font
Name = "Times New Roman"
Size = 18.75
Charset = 0
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 5760
TabIndex = 3
Top = 360
Width = 4215
End
Begin VB.Label Label1
Caption = "Select Product"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 2
Top = 1680
Width = 1815
End
Begin VB.Image imgProduct
BorderStyle = 1 'Fixed Single
Height = 4335
Left = 2280
Stretch = -1 'True
Top = 2520
Width = 5535
End
Begin VB.Label Label3
Caption = "Product Image"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 1
Top = 2520
Width = 1815
End
End
Attribute VB_Name = "frmChunkSize"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************************
' @author Jagriti
' @version 1.0
'
' Development Environment : MS-Visual Basic 6.0
' Name of the Application : chunkSizeSample.vbp
' Creation/Modification History :
'
' Jagriti 23-Jul-2001 Created
'
' Overview of Application :
'
' This sample aims at demonstrating the use of ADO ChunkSize property versus ADO Value
' property. With ADO Value Property the whole column value is fetched in a single
' network roundtrip from the database, though the data retrieval performance is
' always high but this requires more memory at the client side. So it is not feasible
' for huge column data like LOBs. With ADO ChunkSize Property the data is retrieved in
' chunks of bytes and the number of roundtrips made is equal to(size of data/ChunkSize).
' This requires less memory at client side but degrades the performance as more
' roundtrips to the database. Therefore by providing an optimized value of chunk size
' helps in efficently utilizing resources where system memory is limited.
'
' When this application runs, a list of products populated from Product_Information
' database table appears. The user can select a product from the list. Then choose the
' option of either Value Property or ChunkSize Property. If Value property is chosen then
' directly the "Display Image" button can be pressed and time taken to get the image can be
' noted. Else if ChunkSize property is chosen then a value for ChunkSize can be entered
' and the time taken and No. of round trips can be noted after clicking the
' "Display Image" button. Therefore a comparison can be made between Value property and ChunkSize
' property and an optimized ChunkSize value can be found for retrieving images.
'
'***************************************************************************************
Option Explicit
'a single session of connection used throughout the form
Dim m_Oracon As ADODB.Connection
'recordset for populating product_id and product_name in the combobox
Dim m_recProductInformation As New ADODB.Recordset
'variable for holding ChunkSize value entered in the textbox
Dim m_chunksize As Long
'"QueryPerformanceCounter" is used to obtain the current reading of the system's
'high-performance timer. The high-performance timer is a counter that the system
'increments many times a second.
Private Declare Function QueryPerformanceCounter Lib "Kernel32" _
(X As Currency) As Boolean
'"QueryPerformanceFrequency" obtains the frequency of the
'high-performance timer to measure small intervals of time precisely.
Private Declare Function QueryPerformanceFrequency Lib "Kernel32" _
(X As Currency) As Boolean
'**************************************************************
' This sub procedure populates the select product combobox
' with products from Product_Information database table.
'**************************************************************
Private Sub Form_Load()
Dim i As Integer 'counter variable
i = 0
On Error GoTo ErrorText 'redirect to error handler
'setting mouser pointer on "frmChunkSize" form to wait state
frmChunkSize.MousePointer = vbHourglass
'set connection parameters in connectionParams.bas module
connectionParams.setparams
Set m_Oracon = CreateObject("ADODB.Connection") 'creates a connection object
'setting information for establishing connection
'set provider and connection parameters for database connection
m_Oracon.Provider = "OraOLEDB.Oracle"
'get the connection parameters from "connectionParams.bas" file
m_Oracon.ConnectionString = "Data Source=" + connectionParams.datasource & _
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -