'*************************************************************************
' @author : Jagriti
' @version : 1.0
' Development
Environment : Microsoft Visual Studio.NET
' Name of the
File : Bfile.vb
'
Creation/Modification History :
' 4-Apr-2003 Created
'
' Sample
Overview:
' The purpose of
this sample is to demonstrate how BFILEs can be accessed
' through Oracle
Data Provider for .NET (ODP.NET). This file contains
' methods that
are used to insert and retrieve BFILE.
'***************************************************************************
' Standard
Namespaces referenced in this sample
Imports System.Data
Imports System.IO
Imports System.Text
' ODP.NET
specific Namespaces referenced in this sample
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class
BFileFrm
Inherits
System.Windows.Forms.Form
' Connection Object
Dim conn As New
OracleConnection()
Dim connectionStatus As Boolean
#Region
" Windows Form Designer generated code "
Public Sub
New()
MyBase.New()
'This call is required by the
Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up
the component list.
Protected Overloads Overrides Sub Dispose(ByVal
disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form
Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is
required by the Windows Form Designer
'It can be modified using the Windows
Form Designer.
'Do not modify it using the code
editor.
Friend WithEvents
UserName As System.Windows.Forms.TextBox
Friend WithEvents
Password As System.Windows.Forms.TextBox
Friend WithEvents
DataSource As System.Windows.Forms.TextBox
Friend WithEvents
ButtonConnect As System.Windows.Forms.Button
Friend WithEvents
SaveButton As System.Windows.Forms.Button
Friend WithEvents
DisplayButton As System.Windows.Forms.Button
Friend WithEvents
DirPath As System.Windows.Forms.TextBox
Friend WithEvents
PicBx As System.Windows.Forms.PictureBox
Friend WithEvents
Label4 As System.Windows.Forms.Label
Friend WithEvents
MsgTxt As System.Windows.Forms.TextBox
Friend WithEvents
Label6 As System.Windows.Forms.Label
Friend WithEvents
PasswordLabel As System.Windows.Forms.Label
Friend WithEvents
UserNameLabel As System.Windows.Forms.Label
Friend WithEvents
Connection As System.Windows.Forms.GroupBox
Friend WithEvents
Status As System.Windows.Forms.Label
Friend WithEvents
StatusLabel As System.Windows.Forms.Label
Friend WithEvents
ButtonExit As System.Windows.Forms.Button
Friend WithEvents
ConnectStringLabel As
System.Windows.Forms.Label
Friend WithEvents
Label1 As System.Windows.Forms.Label
Friend WithEvents
Label3 As System.Windows.Forms.Label
Friend WithEvents
Label7 As System.Windows.Forms.Label
Friend WithEvents
Label2 As System.Windows.Forms.Label
Friend WithEvents
Label5 As System.Windows.Forms.Label
Friend WithEvents
Disconnect As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.UserName = New System.Windows.Forms.TextBox()
Me.DirPath = New System.Windows.Forms.TextBox()
Me.SaveButton = New System.Windows.Forms.Button()
Me.PicBx = New System.Windows.Forms.PictureBox()
Me.DisplayButton = New System.Windows.Forms.Button()
Me.Label4 = New System.Windows.Forms.Label()
Me.MsgTxt = New System.Windows.Forms.TextBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.Password = New System.Windows.Forms.TextBox()
Me.PasswordLabel = New
System.Windows.Forms.Label()
Me.UserNameLabel = New System.Windows.Forms.Label()
Me.Connection = New System.Windows.Forms.GroupBox()
Me.Status = New System.Windows.Forms.Label()
Me.StatusLabel = New System.Windows.Forms.Label()
Me.ButtonExit = New System.Windows.Forms.Button()
Me.ButtonConnect = New System.Windows.Forms.Button()
Me.ConnectStringLabel = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Disconnect = New System.Windows.Forms.Button()
Me.DataSource = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label7 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.Connection.SuspendLayout()
Me.SuspendLayout()
'
'UserName
'
Me.UserName.Location = New System.Drawing.Point(96, 72)
Me.UserName.Name =
"UserName"
Me.UserName.Size = New System.Drawing.Size(88, 20)
Me.UserName.TabIndex = 0
Me.UserName.Text =
""
'
'DirPath
'
Me.DirPath.Enabled = False
Me.DirPath.Location = New System.Drawing.Point(32, 184)
Me.DirPath.Name =
"DirPath"
Me.DirPath.Size = New System.Drawing.Size(248, 20)
Me.DirPath.TabIndex = 6
Me.DirPath.Text =
""
'
'SaveButton
'
Me.SaveButton.Enabled = False
Me.SaveButton.Font = New System.Drawing.Font("Verdana", 8.25!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.SaveButton.Location = New System.Drawing.Point(112, 264)
Me.SaveButton.Name =
"SaveButton"
Me.SaveButton.Size = New System.Drawing.Size(104, 24)
Me.SaveButton.TabIndex = 5
Me.SaveButton.Text =
"Save Image"
'
'PicBx
'
Me.PicBx.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle
Me.PicBx.Location = New System.Drawing.Point(320, 184)
Me.PicBx.Name =
"PicBx"
Me.PicBx.Size = New System.Drawing.Size(232, 176)
Me.PicBx.TabIndex = 7
Me.PicBx.TabStop = False
'
'DisplayButton
'
Me.DisplayButton.Enabled = False
Me.DisplayButton.Font = New System.Drawing.Font("Verdana", 8.25!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.DisplayButton.Location =
New System.Drawing.Point(112, 304)
Me.DisplayButton.Name =
"DisplayButton"
Me.DisplayButton.Size = New System.Drawing.Size(104, 24)
Me.DisplayButton.TabIndex =
6
Me.DisplayButton.Text =
"Display Image"
'
'Label4
'
Me.Label4.Font = New System.Drawing.Font("Verdana", 12.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.Location = New System.Drawing.Point(176, 8)
Me.Label4.Name =
"Label4"
Me.Label4.Size = New System.Drawing.Size(256, 24)
Me.Label4.TabIndex = 10
Me.Label4.Text =
"Accessing BFile Sample"
'
'MsgTxt
'
Me.MsgTxt.BackColor =
System.Drawing.Color.White
Me.MsgTxt.Enabled = False
Me.MsgTxt.Location = New System.Drawing.Point(8, 376)
Me.MsgTxt.Multiline = True
Me.MsgTxt.Name =
"MsgTxt"
Me.MsgTxt.ReadOnly = True
Me.MsgTxt.ScrollBars =
System.Windows.Forms.ScrollBars.Vertical
Me.MsgTxt.Size = New System.Drawing.Size(544, 144)
Me.MsgTxt.TabIndex = 14
Me.MsgTxt.Text =
""
'
'Label6
'
Me.Label6.Font = New System.Drawing.Font("Verdana", 8.25!,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label6.Location = New System.Drawing.Point(8, 160)
Me.Label6.Name =
"Label6"
Me.Label6.Size = New System.Drawing.Size(384, 16)
Me.Label6.TabIndex = 15
Me.Label6.Text =
"Enter directory path on database server where image file is stored"
'
'Password
'
Me.Password.Location = New System.Drawing.Point(264, 72)
Me.Password.Name =
"Password"
Me.Password.PasswordChar =
Microsoft.VisualBasic.ChrW(42)
Me.Password.Size = New System.Drawing.Size(80, 20)
Me.Password.TabIndex = 1
Me.Password.Text =
""
'
'PasswordLabel
'
Me.PasswordLabel.Font = New System.Drawing.Font("Microsoft Sans
Serif", 10.25!)
Me.PasswordLabel.Location =
New System.Drawing.Point(192, 72)
Me.PasswordLabel.Name =
"PasswordLabel"
Me.PasswordLabel.Size = New System.Drawing.Size(72, 24)
Me.PasswordLabel.TabIndex =
18
Me.PasswordLabel.Text =
"Password"
'
'UserNameLabel
'
Me.UserNameLabel.Font = New System.Drawing.Font("Microsoft Sans
Serif", 10.25!)
Me.UserNameLabel.Location =
New System.Drawing.Point(16, 72)
Me.UserNameLabel.Name =
"UserNameLabel"
Me.UserNameLabel.Size = New System.Drawing.Size(80, 16)
Me.UserNameLabel.TabIndex =
16
Me.UserNameLabel.Text =
"User Name"
'
'Connection
'
Me.Connection.Controls.AddRange(New System.Windows.Forms.Control() {Me.Status, Me.StatusLabel,
Me.ButtonExit, Me.ButtonConnect,
Me.ConnectStringLabel, Me.Label3,
Me.Disconnect, Me.DataSource})
Me.Connection.Location = New System.Drawing.Point(8, 56)
Me.Connection.Name =
"Connection"
Me.Connection.Size = New System.Drawing.Size(544, 80)
Me.Connection.TabIndex = 20
Me.Connection.TabStop = False
Me.Connection.Text =
"Connection Details"
'
'Status
'
Me.Status.Font = New System.Drawing.Font("Arial", 8.25!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Status.ForeColor =
System.Drawing.Color.Red
Me.Status.ImageAlign =
System.Drawing.ContentAlignment.BottomCenter
Me.Status.Location = New System.Drawing.Point(80, 56)
Me.Status.Name =
"Status"
Me.Status.Size = New System.Drawing.Size(120, 16)
Me.Status.TabIndex = 5
Me.Status.Text = "Not
Connected"
'
'StatusLabel
'
Me.StatusLabel.Font = New System.Drawing.Font("Arial", 8.25!,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.StatusLabel.Location = New System.Drawing.Point(16, 56)
Me.StatusLabel.Name =
"StatusLabel"
Me.StatusLabel.Size = New System.Drawing.Size(48, 16)
Me.StatusLabel.TabIndex = 4
Me.StatusLabel.Text =
"Status: "
'
'ButtonExit
'
Me.ButtonExit.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ButtonExit.Location = New System.Drawing.Point(496, 48)
Me.ButtonExit.Name =
"ButtonExit"
Me.ButtonExit.Size = New System.Drawing.Size(40, 24)
Me.ButtonExit.TabIndex = 4
Me.ButtonExit.Text = "
Exit"
'
'ButtonConnect
'
Me.ButtonConnect.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ButtonConnect.Location =
New System.Drawing.Point(328, 48)
Me.ButtonConnect.Name =
"ButtonConnect"
Me.ButtonConnect.Size = New
System.Drawing.Size(64, 24)
Me.ButtonConnect.TabIndex =
3
Me.ButtonConnect.Text =
"Connect "
'
'ConnectStringLabel
'
Me.ConnectStringLabel.Font
= New System.Drawing.Font("Arial",
10.25!)
Me.ConnectStringLabel.Location
= New System.Drawing.Point(344, 16)
Me.ConnectStringLabel.Name
= "ConnectStringLabel"
Me.ConnectStringLabel.Size
= New System.Drawing.Size(104, 24)
Me.ConnectStringLabel.TabIndex
= 0
Me.ConnectStringLabel.Text
= "Connect String"
'
'Label3
'
Me.Label3.Font = New System.Drawing.Font("Verdana", 8.25!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.Location = New System.Drawing.Point(304, 56)
Me.Label3.Name =
"Label3"
Me.Label3.Size = New System.Drawing.Size(16, 16)
Me.Label3.TabIndex = 23
Me.Label3.Text =
"1."
'
'Disconnect
'
Me.Disconnect.Enabled = False
Me.Disconnect.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Disconnect.Location = New System.Drawing.Point(408, 48)
Me.Disconnect.Name =
"Disconnect"
Me.Disconnect.Size = New System.Drawing.Size(72, 24)
Me.Disconnect.TabIndex = 24
Me.Disconnect.Text =
"Disconnect"
'
'DataSource
'
Me.DataSource.AcceptsTab = True
Me.DataSource.Location = New System.Drawing.Point(448, 16)