4 |
The LA Fox Developer Newsletter
ADO J urn psta rt
(Cony from page 3)
cChars
=
For nDigit
=
I To Len(cBin)
nBin
=
Asc(Substr(cBin, nDigit,
1))
cChars
=
cChars
+
Thls.Hex2Char(Int(nBinhl6))
+
This.Hex2Char(Mod(nBin,16))
EndFor
Return(cChars)
EndProc
Protected Procedure hex2char(nHex)
*/
This method converts a hex value to ASCII
Local nAsc
Do Case
Case Between(nHex,0,9)
nAsc =48
+
nHex
Case Between(nHex,10,15)
nAsc
=
65
+
nHex
-
10
EndCase
Return(Chr(nAsc))
EndProc
Procedure import(cString)
*/
This method takes the binary string and populates the 4 data
*/
properties
With This
.Datal
=
Left(cString, Len(.Datal))
cStrlng
=
SubStr(cStrlng, Len(.Datal)+1)
.Data2
=
Left(cString, Len(.Data2))
cStrlng
=
SubStr(cString, Len(.Data2)+1)
.Data3
=
Left(cString, Len(.Data3))
cString
=
SubStr(cString, Len(.Data3)+1)
.Data4
=
Left(cString, Len(.Data4))
EndWith
Return cString
EndProc
Protected Procedure export
*/
This method creates the buffer to pass to the GUID API.
With This
.Datal
=
Space(4)
.Data2
=
Space(2)
.Data3
=
Space(2)
.Data4
=
Space(8)
End With
Return(This.Datal
+
This.Data2
+
This.Data3
+
This.Data4)
EndProc
Protected Procedure Convert(cGuid)
•I This method makes the call to the BinToHex that
*/
converts the data in the 4 data properties from
With This
cGuid
=
.BinToHex(.Datal)
+
“-“
+
.BinToHex(.Data2)
+
“-“
May 2000
.BlnToHex(.Data3)
+
“-“
+
.BlnToHex(.Data4)
Return cGuid
Endwith
EndProc
Procedure
Init
*/
Declare the function In the DLL
Declare Integer UuidCreate
In c:\Winnt\System32\RPCRT4.DLL String
@
UUID
Return
EndProc
EndDefine
Output is produced as follows:
Disconnected/Persisted Recordsets
One of the most powerful features of ADO is the ability to create
both disconnected and persisted recordsets. A disconnected
recordset is a client-side recordset that does not have a current
ActiveConnection. SQL data sources, such as SQL Server,
Oracle, and so on, are licensed according to the number of
concurrent connections. For example, the number of people that
using an application connected to SQL Server is 300. However,
it has been determined that at any time, only 50 users actually
use the services of a connection. A connection is needed only
when data is being requested, updates are made, or a stored
procedure on the database server is invoked. From a financial
standpoint, it is far less expensive for a company to only
purchase 50 licenses than to purchase 300. From a resource
standpoint, performance should improve because the server only
has the overhead of 50 connections instead of 300, of which 250
are idle at any time.
Using the ADO recordset of customer data already created, the
following code disconnects the client-side recordset:
oRecordSet.ActiveConnection
=
Null
If you attempt to do this with a server-side recordset, an error
occurs stating that the operation is not allowed on an open
recordset. Once the recordset is disconnected, you can con-
tinue to work with and modify records. The following code will
work:
oRecordset.MoveFirst
Do While loRecordset.Eof
?oRecordset. FieIds(”companyname”).Value
oRecordset.Fields(”companyname”).Value
=
Upper(oRecordset.FieIds(”companyname”).Value)
oRecordset.MoveNext
EndDo
With
modified records in a client-side recordset, three basic
options exist.
(Con ‘t,
page
5)
Page 4
|
4 |