M415 Using Adaptive Server Anywhere and UltraLite with Visual Basic

1 / 78
About This Presentation
Title:

M415 Using Adaptive Server Anywhere and UltraLite with Visual Basic

Description:

SQL CODE : ' & adoErr.NativeError ... Pessimistic Locking: The lock is done on the edited records at the data source. ... Visual Basic and its Data Interface. ... –

Number of Views:84
Avg rating:3.0/5.0
Slides: 79
Provided by: Kar9252
Category:

less

Transcript and Presenter's Notes

Title: M415 Using Adaptive Server Anywhere and UltraLite with Visual Basic


1
M415Using Adaptive Server Anywhere and UltraLite
with Visual Basic
  • Ali Chalhoub
  • Technical Consultant Specialist
  • iAnywhere Solutions
  • achalhou_at_sybase.com

2
Using Adaptive Server Anywhere with Visual Basic
  • ADO Programming Using Adaptive Server Anywhere
    OLE DB Provider.
  • Working with Blobs.
  • Introduction to ASA on Windows CE.
  • Introduction to UltraLite on Windows CE.
  • Summary

3
Adaptive Server Anywhere OLE Provider
  • Introduction to ADO.
  • Introduction to ASA OLE DB Provider.
  • Advantage of using ASA OLE DB Provider.
  • Supported Platforms.
  • Registry Entry.
  • ADO Programming with Adaptive Server Anywhere.

4
Visual Basic and its Data Interface
  • ADO (ActiveX Data Object)
  • ADO is an application programming interface to
    OLE DB. OLE DB is a low-level interface to all
    types of data. Thats why it is called Universal
    Data Access (UDA).
  • OLE DB ( Component Object Model )
  • OLE DB is a data access model from Microsoft. It
    uses Component Object Model (COM) interfaces that
    provide applications with uniform access to data
    stored in diverse information sources.

5
Adaptive Server Anywhere OLE Provider
  • Introduction to ADO.
  • Introduction to ASA OLE DB Provider.
  • Advantage of using ASA OLE DB Provider.
  • Supported Platforms.
  • Registry Entry.
  • ADO Programming with Adaptive Server Anywhere.

6
Introduction to ASA OLE DB Provider
  • Adaptive Server Anywhere includes an OLE DB
    provider
  • named ASAProv. This provider is available for
    windows
  • and windows CE.
  • Adaptive Server Anywhere can also be accessed
    through
  • Microsofts OLE DB provider, MSDASQL, to be used
    with
  • the Adaptive Server Anywhere ODBC Driver.

7
Connection Flow
VB Application
ADO
MS OLEDB Provider
ASA OLE DB Provider
ODBC
ASA
8
Adaptive Server Anywhere OLE Provider
  • Introduction to ADO.
  • Introduction to ASA OLE DB Provider.
  • Advantage of using ASA OLE DB Provider.
  • Supported Platforms.
  • Registry Entry.
  • ADO Programming with Adaptive Server Anywhere.

9
Advantage of Using ASA OLE DB Provider
  • Why using Adaptive Server Anywhere is
  • better than using Microsofts generic OLE
  • DB provider?
  • No need to use ODBC in your deployment if ASA OLE
    DB provider is used.
  • Performance.

10
Adaptive Server Anywhere OLE Provider
  • Introduction to ASA OLE DB Provider.
  • Advantage of using ASA OLE DB Provider.
  • Supported Platforms.
  • Registry Entry.
  • ADO Programming with Adaptive Server Anywhere.

11
Supported Platform
  • The ASA OLE DB provider is designed to support
    the following
  • ADO 2.X
  • ADO.NET (Check the following M410 M402 )
  • The ASA OLE DB provider works with ADOCE 3.0 and
    later.
  • ADOCE 3.0 is included in the new Windows CE 3.0
    devices, such as PocketPC.

12
Adaptive Server Anywhere OLE Provider
  • Introduction to ASA OLE DB Provider.
  • Advantage of using ASA OLE DB Provider.
  • Supported Platforms.
  • Registry Entry.
  • ADO Programming with Adaptive Server Anywhere.

13
Registry Entry
  • When the ASAProv provider is installed, it
    registers itself. The ASAProv is registered under
    the following key HKEY_CLASSES_ROOT\ASAProv
  • If you change the location of your DLL, you must
    reregister it

14
Registry Entry
  • To register the OLE DB provider
  • Open a command prompt ( DOS prompt)
  • Change to the directory where the OLE DB provider
    is installed. (Default C\Program
    Files\Sybase\SQL Anywhere 8\win32)
  • Enter the following command to register the
    provider
  • Regsvr32 dboledb8.dll

15
Adaptive Server Anywhere OLE Provider
  • Introduction to ADO.
  • Introduction to ASA OLE DB Provider.
  • Advantage of using ASA OLE DB Provider.
  • Supported Platforms.
  • Registry Entry.
  • ADO Programming with Adaptive Server Anywhere.

16
ADO Programming with Adaptive Server Anywhere
  • Connecting to a database using the connection
    object.
  • Executing statements with the command object.
  • Working with stored procedures.
  • Working with Recordset object.

17
Connecting to a Database Using the Connection
Object
  • In order to connect to
  • Adaptive Server Anywhere
  • you must have at least the
  • user id, password and
  • provider. Check the following
  • Table for more information.

ConnectionString Value
Provider ASAProv
UID User ID
PWD User Password
ENG Server Name
DBF Database File
DBN Database Name
Linkstcpip hostx.x.x.x
DSN Data Source Name
18
Connecting to a Database with the Connection
Object
  • Before the connection can be
  • established, a reference to the
  • ADO library must be set. To set the
  • reference to the library.
  • The following should be done
  • Select References from the Project Menu.
  • Set a reference to the Microsoft ActiveX Data
    Object 2.x Library (i.e ActiveX Data Object 2.6
    ).

19
Connecting to a Database with the Connection
Object
  • Option Explicit
  • Dim adoConn as new ADODB.connection
  • Private Sub cmdConnect_Click()
  • adoConn.Provider ASAProv
  • adoConn.ConnectionString uiddbapwdsqldbf
    app.path \asademo.db
  • adoConn.Open
  • End Sub

20
ADO Programming with Adaptive Server Anywhere
  • Connecting to a database using the connection
    object.
  • Executing statements with the command object.
  • Working with stored procedures.
  • Working with Recordset objects.

21
Executing Statements with the Command Object
Option Explicit Dim adoConn as new
ADODB.connection Private Sub cmdConnect_Click() Di
m adoCmd As New ADODB.Command Set
adoCmd.ActiveConnection adoConn adoCmd.CommandTe
xt "INSERT INTO department VALUES(600,'Accountin
g',1090)" adoCmd.CommandType adCmdText adoCmd.Ex
ecute End Sub
22
Prepared Statement
  • Improved performance
  • The first time the SQL statement is executed
  • It is parsed and the parsed tree is saved in the
    engine.
  • At this point, the optimizer generates the
    execution plan.
  • Correctness of all referenced database objects is
    verified
  • On subsequent calls, this ground work does not
    have to be repeated

23
Command Object with Prepared Statement
Dim adoCmd As New ADODB.Command Set
adoCmd.ActiveConnection adoConn adoCmd.CommandTe
xt "UPDATE employee set emp_fname?,
emp_lname? WHERE emp_id?" adoCmd.CommandType
adCmdText adoCmd.Prepared True Dim prmEmpFName
As New ADODB.Parameter Set prmEmpFName
adoCmd.CreateParameter("EmpFName", adChar,
adParamInput, 20,txtFirstName.text) adoCmd.Paramet
ers.Append prmEmpFName Dim prmEmpLName As New
ADODB.Parameter Set prmEmpLName
adoCmd.CreateParameter("EmpLName", adChar,
adParamInput, 20,txtLastName.text) adoCmd.Paramete
rs.Append prmEmpLName Dim prmEmpID As New
ADODB.Parameter Set prmEmpID adoCmd.CreateParame
ter("EmpID", adInteger, adParamInput,
,val(txtEmpID.text) ) adoCmd.Parameters.Append
prmEmpID
24
Command Object with Prepared Statement
Private Sub cmdUpdate_Click() adoCmd("EmpFName")
txtFirstName.Text adoCmd("EmpLName")
txtLastName.Text adoCmd("EmpID")
Val(txtEmpID.Text) adoCmd.Execute MsgBox
"Successfully Updated!" End Sub
25
ADO Programming with Adaptive Server Anywhere
  • Connecting to a database using the connection
    object.
  • Executing statements with the command object.
  • Working with stored procedures.
  • Working with Recordset objects.

26
Working with Stored Procedures
  • What is a stored procedure?
  • Stored procedure is procedure kept in the
    database itself which can be called from client
    application.
  • Stored procedure provides a way of providing
    uniform access to functions automatically, as
    the procedure is held in the database, not in
    each client application.

27
Working with Stored Procedures
CREATE PROCEDURE sp_retrieve_contacts() RESULT(id
integer,last_name char(15),first_name
char(15),title char(2),street char(30),city
char(20),state char(2),zip char(5),phone
char(10),fax char(10)) BEGIN SELECT
id,last_name,first_name,title,street,city,state,zi
p,phone,fax FROM contact ORDER BY contact.id
asc END
28
Working with Stored Procedures
Private Sub cmdExecuteProcedure_Click() Dim
adoRS As New ADODB.Recordset adoRS.Open
"sp_retrieve_contacts", adoConn, adOpenStatic,
adLockReadOnly, adCmdStoredProc adoRS.MoveFirst S
et grdData.DataSource adoRS grdData.Refresh End
Sub
29
Error Handling
Private Sub ErrorHandler() Dim adoErr as
ADODB.Error For Each adoErr In adoConn.Errors
strErr strErr " Description "
adoErr.Description vbCrLf vbCrLf _
" SQL CODE "
adoErr.NativeError vbCrLf vbCrLf _
" SQL STATE " adoErr.SQLState
vbCrLf Next MsgBox strErr, vbCritical
vbOKOnly, "Error Connecting End Sub
30
ADO Programming with Adaptive Server Anywhere
  • Connecting to a database using the connection
    object.
  • Executing statements with the command object.
  • Working with stored procedures.
  • Working with Recordset objects.

31
Working with Recordset Object
  • What is a Recordset?
  • ADO Recordset is a set of rows.
  • ADO Recordset allows you to set the CursorType
    property, before you open it.
  • Check the ASA Users Guide for Types of Cursor

32
Working with Recordset Object
  • Recordset Open method syntax
  • Recordset-object.Open source, ActiveConection,
    CursorType, LockType,Options
  • Source It could be in-line
    SQL, stored procedure or
  • table name.
  • ActiveConnection It tells the open method how
    to access the
  • database.
  • CursorType It tells the database what
    cursor to use when
  • opening the
    Recordest.

33
Working with Recordset Object
ADO Cursor Type ADO constant Adaptive Server Anywhere type
Dynamic cursor adOpenDynamic Dynamic scroll cursor
Keyset cursor adOpenKeyset Scroll cursor
Static cursor adOpenStatic Insensitive cursor
Forward only adOpenForwardOnly No-scroll cursor
34
Working with Recordset Object
  • LockType It specifies the type of locking the
    database
  • should use on the record set
    when editing of
  • records occurs.
  • Options It tells the database what type the
    source is.
  • (I.e adCmdTable,
    adCmdText,etc..)

35
Working with Recordset Object
  • Locking types are
  • Optimistic Locking The lock is done on row by
    row basis, when Update is called.
  • Batch Optimistic Locking The lock occurs when
    UpdateBatch is called.
  • Pessimistic Locking The lock is done on the
    edited records at the data source.
  • Read Only Locking There is no Locking and the
    data cant be changed.

36
Working with Recordset Object
Private Sub cmdOpenRecordSet_Click() On Error
GoTo cmdOpenDoubleRecordSet_Err Call
GetEmployeesAndDept Call LoadEmployeeName Set
adoRS adoRS.NextRecordset Call LoadDept Call
CloseRecordSet Exit Sub cmdOpenDoubleRecordSet_Err
Call ErrorHandler End Sub
37
Working with Recordset Object
CREATE PROCEDURE DBA.GetEmployeesAndDept()
BEGIN SELECT emp_fname FROM employee SELECT
dept_name FROM department END
38
Working with Double Recordset
Private Sub GetEmployeesAndDepat() On Error GoTo
getEmpAndDept_err Set adoRS New
ADODB.Recordset adoRS.Open "call
GetEmployeesAndDept()", adoConn, adOpenStatic,
adLockReadOnly, adCmdText Exit Sub
getEmpAndDept_err Call ErrorHandler
End Sub
Private Sub LoadEmployeeName()
lstEmployee.Clear Do While Not adoRS.EOF
lstEmployee.AddItem adoRS!emp_fname
adoRS.MoveNext Loop End Sub Private Sub
LoadDept() lstDept.Clear Do While Not
adoRS.EOF lstDept.AddItem
adoRS!Dept_name adoRS.MoveNext Loop
End Sub
39
Where Are We?
  • Visual Basic and its Data Interface.
  • ADO Programming Using Adaptive Server Anywhere
    OLE DB Provider.
  • Working with BLOBS.
  • Introduction to ASA on Windows CE.
  • Introduction to UltraLite Windows CE.
  • Summary

40
Working with BLOBS
41
Working with Recordset Object BLOBS
Private Sub cmdFetchDirect_Click() If
Len(txtPictID.Text) gt 0 Then adors.Open
"select id, logo from logos where id "
CInt(txtPictID.Text), adoconn, adOpenDynamic,
adLockOptimistic If
adors.BOF And adors.EOF Then MsgBox
No records found" Else Set
pctImage.DataSource adors
pctImage.DataField adors.Fields.Item(1).Name
End If adors.Close Set adors
Nothing End If End Sub
Private Sub cmdSave_Click() On Error GoTo
showError If Len(txtpath.Text) ltgt 0 Then
adocmd.ActiveConnection adoconn
adocmd.CommandText " INSERT INTO logos(logo)
SELECT xp_read_file('" txtpath.Text "' )"
adocmd.Execute MsgBox "Successfully
inserted" End If Exit Sub showError MsgBox
"Failed to insert" End Sub
42
Working with Recordset Object BLOBS
Private Sub cmdSavedDirect_Click() Dim bytChunk()
As Byte Open txtpath.Text For Binary As
1 ReDim bytChunk(FileLen(txtpath.Text)) Get 1,
, bytChunk() adors.Open "logos", adoconn,
adOpenKeyset, adLockPessimistic,
adCmdTable adors.AddNew adors!logo.AppendChunk
bytChunk adors.Update adors.Close Set adors
Nothing MsgBox "Successfully Inserted!" Close
1 End Sub
43
Working with Long VarChar
  • Saving data of type Long VarChar
  • Replace(expression, find, replace, start,
    count, compare)

Dim strLog As String Set adoCmd New
ADODB.Command 'Escape Character Replace(txtDoc.Te
xt, " ' ", " ' ' ", , , vbTextCompare) strLog
Replace(txtDoc.Text, "'", "''", , ,
vbTextCompare) adoCmd.ActiveConnection
adoConn adoCmd.CommandText "INSERT INTO
logs(lognote, logdate) VALUES('" strLog "','"
Format(clnDate.Value, "mm-dd-yyyy")
"')" adoCmd.CommandType adCmdText adoCmd.Execute
44
Where Are We?
  • Visual Basic and its Data Interface.
  • ADO Programming Using Adaptive Server Anywhere
    OLE DB Provider.
  • Working with Blobs.
  • Introduction to ASA on Windows CE.
  • Introduction to UltraLite Windows CE.
  • Summary

45
Introduction to ADOCE
  • What is ADOCE?
  • ADOCE Programming with Adaptive Server Anywhere.

46
What is ADOCE?
  • ADOCE is a subset of ADO.
  • Microsoft has released an IDE, eVB, to develop
    for Windows CE.

47
Adaptive Server Anywhere OLE Provider
  • Connecting to an ASA Engine.
  • Creating Recordsets.
  • Navigating Recordsets.
  • Working with Blobs.

48
Connecting to an ASA Engine
  1. Create a DSN file.
  2. Place the DSN on the root of the CE device.
  3. Create the connection string.

ODBC uiddba pwdsql enginenameasademo Database
nameasademo databasefile\asademo.db start\progr
am files\sybase\asa\dbsrv8.exe
asademo.dsn
49
Connecting to ASA Engine
Private Sub cmdConnect_Click() If
(ConnectToSybaseDatabase("image")) Then
MsgBox "Connected Successfully!" End If End Sub
50
Connecting to ASA Engine
Option Explicit Dim Connection Function
ConnectToSybaseDatabase(DSNname) 'Create the
ADOCE connection object Set Connection
CreateObject("ADOCE.connection.3.1") 'Open the
ASA provider Connection.Open
"ProviderASAProvData Source" DSNname
ConnectToSybaseDatabase True End Function
51
Working with Recordset on CE
Dim RecSet Private Sub FetchData() Set RecSet
CreateObject("ADOCE.RecordSet.3.1") RecSet.Open
"call sp_retrieve_contacts()", Connection,
adOpenKeyset, adLockReadOnly, adCmdText RecSet.Mo
veFirst Call loadData End Sub
52
Navigating Recordsets
Private Sub loadData() If not IsNull(RecSet.Fields
(first_name).value) Then txtfname.Text
RecSet.Fields(first_name).Value If not IsNull(
RecSet.Fields(last_name).value)
Then txtlname.Text RecSet.Fields(last_name).V
alue If not IsNull( RecSet.Fields(street).value)
Then txtAddress.Text RecSet.Fields(street).V
alue End Sub
Private Sub cmdNext_Click() RecSet.MoveNext If
RecSet.EOF Then RecSet.MovePrevious End
If Call loadData End Sub
Private Sub cmdPrevious_Click() RecSet.MovePreviou
s If RecSet.BOF Then RecSet.MoveNext End
If Call loadData End Sub
53
Error Handler
VBCE doesnt allow you to have goto label. ADOCE
doesnt allow you to loop through your error
object. On Error Resume Next If Err.Number ltgt
0 then MsgBox Error
Err.Number Err.Clear End If
54
Working with Blobs on CE
  • What is it needed to insert an image into a
    table.
  • ceFile control.
  • Variable to hold the image.
  • Recordset to perform the insertion.
  • What is it needed to fetch an image from a table.
  • OSIUtil utility
  • Recordset to fetch the image.
  • Variable to hold the image when it is read from
    the database.
  • A temp file to write the image, using the File
    object in OSIUtil.

55
Insert an Image on CE Database
  • Dim RecSet
  • Dim laImage As Variant
  • Set RecSet CreateObject("ADOCE.RecordSet.3.1")
  • RecSet.Open "Pictures", Connection, adOpenKeyset,
    adLockOptimistic, adCmdTable
  • ceFile.Open txtImage.Text, fsModeInput,
    fsAccessRead
  • laImage ceFile.InputB(ceFile.LOF)
  • ceFile.Close
  • RecSet.AddNew
  • RecSet.Fields("picture") laImage
  • RecSet.Update

56
Fetching an Image on CE
  • Set RecSet CreateObject("ADOCE.Recordset.3.1")
  • strSQL "select picture from pictures where id
    " CInt(cboPictures.Text)
  • Set RecSet Connection.Execute(strSQL,
    RecordsAffected)
  • Free utility from Odyssey software
  • Set Factory CreateObject("OSIUtil.Win32")
  • Set File Factory.CreateObject("OSIUtil.File")
  • Data RecSet.Fields(0)
  • File.VariantByteArrayToFile "\temp.bmp", Data
  • pctImage.Picture "\temp.bmp"

57
Using Adaptive Server Anywhere with Visual Basic
  • Visual Basic and its Data Interface.
  • ADO Programming Using Adaptive Server Anywhere
    OLE DB Provider.
  • Working with Blobs.
  • Introduction to ASA on Windows CE.
  • Introduction to UltraLite on Windows CE.
  • Summary

58
What is an UltraLite?
  • A deployment option of Adaptive Server Anywhere
  • Aimed at mobile and embedded devices.
  • UltraLite is intended to be used on handheld and
    portable devices such as
  • Personal organizers ( Palm and Pocket PC)

59
UltraLite and eVB
  • ActiveX for UltraLite
  • An UltraLite application can only be created
    using
  • C/C. Today, iAnywhere has developed an ActiveX
  • Component so Visual Basic programmers can develop
    an
  • UltraLite Application using eVB.
  • ActiveX Component
  • This ActiveX component is packaged as a Windows
    DLL,
  • named ULDO8.dll. It provides a Microsoft
    scripting compatible
  • interface to an UltraLite database.

60
UltraLite (ActiveX Control) Features
  • Relational Database
  • UltraLite is a relational database that features
    table based interface.
  • Foreign Key
  • UltraLite supports referential integrity.
  • Restricted option is supported only for the
    foreign key.
  • Default Value
  • A column can contain a default value. (I.e
    Autoincrement).
  • Multiple Index
  • UltraLite supports the creation of multiple
    indexes.

61
UltraLite Limitation
  • No SQL statements support
  • UltraLite doesnt support SQL statements.
  • UltraLite is a table-based API.
  • BLOB Size
  • The maximum size of a BLOB can be stored in an
    UltraLite database is 64K.
  • Join Tables
  • Joining tables in an UltraLite database is not
    supported. You must implement your own joining
    logic.
  • Computed Column
  • UltraLite doesnt support computed column as ASA
    does.

62
Supported Platforms
  • eVB UltraLite application can support the
    following
  • Windows CE 2.11 or higher.
  • ARM, MIPS, SH3, SH4, and Emulator
  • Win32
  • Development Tools
  • Visual Basic 6.0
  • Embedded Visual Basic 3.0
  • AppForge 2.1.1 ( Add-On ) Check (M406)

63
Creating an UltraLite Application for Pocket PC
  • To develop an UltraLite application using eVB we
    need the following.
  • ASA 8.0.1 (ULDO8.dll)
  • EVB 3.0
  • Pocket PC, or Pocket PC 2002

64
Creating an UltraLite Application for Pocket PC
  • Consideration
  • Consolidated database (only if synchronization is
    needed)
  • Adaptive Server Anywhere
  • Oracle, SQL Server, ASE, DB2.
  • Reference database
  • To be able to generate the UltraLite schema.
  • Publication ( Tables to be synchronized ).
  • Schema database
  • UltraLite schema ( Adaptive Server Anywhere )

65
Creating an UltraLite Application for Pocket PC
  • Consolidated
  • Create the following consolidated database.
  • dbinit.exe images.db
  • Reference Database
  • Since the consolidated database is an ASA, it can
    be considered as reference database.
  • Connect to images.db database file.
  • Create a table called Pictures contains three
    columns
  • ID as an autoincrement,Image_Name as varchar,
    Image as long Binary
  • Insert an image inside the table using the
    xp_read_file() stored procedure.
  • Create Publication called PubImage and add the
    Pictures table to it.
  • Schema
  • You must create an ASA DSN to connect to your
    reference database and generate the Schema.
  • Create a DSN called ULBLOBS
  • ulinit -c DSNULBlobs" -n PubImage
  • The generated schema is called ulschema.usm

66
Creating an UltraLite Application for Pocket PC
  • Setting eVB
  • When creating an eVB application, first step is
    to add the UltraLite ActiveX Component to the
    project.
  • Select Project -gt Reference
  • Select the iAnywhere Solutions, ActiveX for
    UltraLite 8.0 (Beta)

67
Sample Application
  • Connect to an UltraLite database.
  • Working with Tables.
  • Synchronize.
  • Fetching an Image.
  • Inserting an Image.
  • Un-Installing/Re-installing the ULDO ActiveX
    control.

68
Connecting to an UltraLite Database
Dim UL_DBMngr as ULDatabaseManager Dim
UL_Connection as ULConnection Set UL_DBMngr
CreateObject(UltraLite.ULDatabaseManager") UL_Con
nection.Open ("file_name\myDB.udb" ) If
UL_Connection.DatabaseNew Then UL_Connection.Sch
ema.UpgradeFromFile (\ulschema.usm) End
if lblstatus.caption Connected Successfully
69
Working with Tables
Dim UL_table As ULTable Dim File, Factory 'Get
the table. Set UL_table UL_Connection.GetTable("
images") 'Open the table UL_table.Open ' 'Check
and see if the image exist UL_table.FindBegin UL_t
able.Columns("ID").Value Int(txtID.Text) If
UL_table.Find Then Fetch the image Else MsgBox
No image found for this id End if
70
MobiLink Synchronization
  • What is MobiLink?
  • It manages the synchronization process and
    provides the interface between all MobiLink
    clients and the consolidated database server.
  • MobiLink client
  • Two types of clients are supported UltraLite
    application and ASA databases.
  • Check the following ( M411 M413 )

71
Synchronization System.
72
Synchronizing an UltraLite Database
  • Running MobiLink Server
  • Dbmlsrv8 c DSNULBLOBS v -zu

Private Sub cmdSync_Click() UL_Connection.SyncInf
o.UserName "ali" UL_Connection.SyncInfo.Version
"ul_default UL_Connection.SyncInfo.StreamParams
hostcomputerName UL_Connection.SyncInfo.Stre
am ulSocket UL_Connection.Synchronize End Sub
73
Fetching an Image
'If found create a file so we can display
it 'to the screen Set Factory
CreateObject("OSIUtil.Win32") Free utility from
Odyssey Software Set File
Factory.CreateObject("OSIUtil.File")
File.VariantByteArrayToFile "\temp.bmp",
UL_table.Columns(Image).Value
pctImage.Picture "\temp.bmp" Set File
Nothing
74
Inserting an Image
Create file object to hold the image Set File
Factory.CreateObject("OSIUtil.File") Start the
insert key. UL_table.InsertBegin Set the name
of the image. UL_table.Columns(Image_Name).Value
myimage.bmp Assign the image to the Image
column UL_table.Columns(Image).Value
File.FileToVariantByteArray ("\myimage.bmp) Ins
ert the image UL_table.Insert UL_table.Close Set
File Nothing
75
Un-Installing the ULDO ActiveX Control
  • Un-Installing the ULDO ActiveX Control from the
    Desktop.
  • Navigate to the directory where ULDO8.dll is
    located.(i.e c\Program Files\Sybase\SQL
    Anywhere 8\UltraLite\Tools\Win32)
  • Issue the following regsvr32 /u uldo8.dll
  • Un-Installing the ULDO ActiveX Control from the
    CE device.
  • Use the control manager to connect
  • Open the eVB project.
  • Select Tools from the file menu.
  • Select Remote Tools.
  • Select Control Manger.
  • Connect to the device.
  • Right click the control and select Un-install.
  • Open the eVB project and uncheck the ULDO ActiveX
    Component and save it.

76
Installing the ULDO ActiveX Control
  • Installing the ULDO ActiveX Control from the
    Desktop.
  • Navigate to the directory where ULDO8.dll is
    located.(i.e c\Program Files\Sybase\SQL
    Anywhere 8\UltraLite\Tools\Win32)
  • Issue the following regsvr32 uldo8.dll
  • Installing the ULDO ActiveX Control from the CE
    device.
  • Use the control manager to connect
  • Open the eVB project.
  • Select Tools from the file menu.
  • Select Remote Tools.
  • Select Control Manger.
  • Connect to the device.
  • Right click in a blank area.
  • Select Add New Control. Select the ULDO for CE.
    (Arm, MIPS, etc)

77
Summary
  • ADO is one of the most recommended method
    compared to the other methods supplied by
    Microsoft is preferred to communicate with ASA
    using the ASA Provider ASAProv.
  • ASA OLE DB provider has benefit over the
    Microsoft OLE DB provider.
  • ASA supports prepared statements, double
    recordsets, stored procedures, triggers, events,
    etc.
  • ASA runs on Windows CE. A DSN is required to
    communicate with the server.
  • eVB will allow to develop an UltraLite
    application aimed at handheld devices.
  • Blob in UltraLite database has a maximum of 64K
    in size.

78
Technical Documents
  • Accessing Data in Adaptive Server Anywhere Using
    ADO and Visual Basic. (White Paper)
  • http//my.sybase.com/detail?id1017429
  • Accessing Data in Adaptive Server Anywhere for
    Windows CE Using ADOCE and Embedded Visual Basic.
    (White Paper)
  • http//my.sybase.com/detail?id1019003
  • Connecting to a SQL Anywhere Database Using
    Visual Basic. (Technote)
  • http//my.sybase.com/detail?id1013782
  • Calling dbmlsync from Within an Embedded Visual
    Basic Application. (Technote)
  • http//my.sybase.com/detail?id1018481
Write a Comment
User Comments (0)
About PowerShow.com