Академический Документы
Профессиональный Документы
Культура Документы
nd Grid) control
The Microsoft FlexGrid (MSFlexGrid) control displays and operates on tabular dat
a. It allows complete flexibility to sort, merge, and format tables containing s
trings and pictures. When bound to a Data control, MSFlexGrid displays read-only
data.Adaptation to existing Visual Basic code for the data-bound grid (DBGrid).
The data grids are bound controls; that is, they require a data source that actu
ally connects to a database and retrieves their data. And it seems that the root
of the problem with DBGrid is that there's no data source that can be readily i
ncluded along with the DBGrid control.
In Visual Basic, the solution is simply to include the Data Control on the same
form as DBGrid. But the Data Control is an intrinsic control; it's unavailable t
o anything outside of the Visual Basic environment itself. and VB 6.0 has a new
set of data controls (DataGrid, DataList, DataCombo, MSHFlexGrid, MSFlexGrid) th
at once again are bound controls. Unlike DBGrid, though, they support OLE DB, an
d therefore rely on the an ADO Data Source (and in particular the ActiveX Data O
bjects Data Control, or ADO DC) for data access. Unlike the Data Control, the AD
O
DC is a custom control (that is, an .OCX) that can be added to any project. In s
hort, if you add ADO DC to your project along with the
DataGrid control.
ActiveX and Types of ActiveX Components in VB ?
Standard EXE
ActiveX EXE
ActiveX DLL
ActiveX document
ActiveX Control
What is difference between inprocess and out of process ?
An in-process component is implemented as a DLL, and runs in the same process sp
ace as its client app, enabling the most efficient communication between client
and component.Each client app that uses the component starts a new instance of i
t.
An out of process component is implemented as an EXE, and unlike a dll, runs in
its own process space. As a result, exe's are slower then dll's
because communications between client and component must be marshalled across pr
ocess boundaries. A single instance of an out of process component can service m
any clients.
Advantage of ActiveX Dll over Active Exe ?
ACTIVEX DLL:
=============
An in-process component, or ActiveX DLL, runs in another application s process. In
-process components are used by applications or other in-process components. thi
s allows you to wrap up common functionality (like an ActiveX Exe).
ACTIVEX EXE:
=============
An out-of-process component, or ActiveX EXE, runs in its own address space. The
client is usually an application running in another process.The code running in
an ActiveX Exe is running in a separate process space. You would usually use thi
s in N-Tier programming.
An ActiveX EXE runs out of process while an ActiveX DLL runs in the same process
space as VB app. Also, and ActiveX EXE can be run independent of your applicati
on if desired.
Explain single thread and multithread thread apartments
All components created with Visual Basic use the apartment model, whether they re
single-threaded or multithreaded. A single-threaded component has only one apart
ment, which contains all the objects the component provides.
This means that a single-threaded DLL created with Visual Basic is safe to use w
ith a multithreaded client. However, there s a performance trade-off for this safe
ty. Calls from all client threads except one are marshaled, just as if they were
out-of-process calls.
What is a Component?
If you compile an ActiveX dll, it becomes a component.
If you compile an ActiveX Control, it becomes both a component and a control. Co
mponent is a general term used to describe code that's grouped by functionality.
More specifically, a component in COM terms is a compiled collection of propert
ies/methods and events.
Typically a component is loaded into your project via the References whereas an
ActiveX Control is loaded into your project via "components".
What is meant by "Early Binding" and "Late Binding"? Which is better?
Early binding and late binding refer to the method used to bind an interface's p
roperties and methods to an object reference (variable). Early binding uses type
library information at design time to reference procedures, while late binding
handles this at run time. Late binding
handles this by interrogating the reference before each call to insure that it s
upports a particular method. Since every call to a late bound
object actually requires two calls
("Do you do this?" followed by "Okay, do it then"), late binding is much less ef
ficient than early binding. Except where early binding is not supported (ASP, sc
ripting, etc.), late binding should only be used in very special cases.
It is a common misconception that any code using the CreateObject function inste
ad of Set = New is using late binding. This is not the case. The type declaratio
n of the object variable determines whether
it is late or early bound, as in the following:
Dim A As Foo
Dim B As Foo
Dim C As Object
Dim D As Object
Set A = New Foo 'Early Bound
Set B = CreateObject("FooLib.Foo") 'Early Bound
Set C = CreateObject("FooLib.Foo") 'Late Bound
Set D = New Foo 'Late Bound
What are the Advantages of disconnected recordsets?
A disconnected Recordset, as its name implies, is a Recordset that lacks a conne
ction.
seen that a Recordset that does not have a database connection can be very usefu
l as a tool in your programming. It can save you time and effort and make your c
ode more scalable.
In order to create a disconnected Recordset two Recordset properties must be set
appropriately.
It is a requirement that the CursorLocation property is set to adUseClient and t
he LockType property is set to adLockBatchOptimistic. Note that the CursorType w
ill default to adUseStatic if we don't explicitly state that it should be set to
adUseClient.) i.e
rst.LockType = adLockBatchOptimistic
rst.CursorLocation = adUseClient
However, we've recently discovered that these steps aren't necessary. VB automat
ically assigns batch optimistic locking to newly created,
connectionless recordsets. And, of course, without a connection, a recordset can
't have any other cursor but a client-side one. To create one of these structure
s, then, the only thing you need do is create
the object variable instance. After that, you can simply begin adding fields to
the construct.
To add fields, you use the Fields collection's Append method. This method requir
es two parameters , the field name and the field data type. So, to create a conn
ectionless recordset with two fields,you'd use code similar to:
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Fields.Append "CustID", adVarChar
rst.Fields.Append "CustName", adVarChar
Additional, optional Append method parameters include DefinedSize and Attrib. Th
e DefinedSize argument takes the size of the field. Fill the Attrib parameter wi
th constants that define additional field characteristics, such as whether it wi
ll allow null values or is updatable.
Since, in our technique, we want the fields to mirror the structure of the origi
nal recordset, we'll simply use existing values for these parameters.
Disconnected Recordsets, first available with ADO 2.0, are the most commonly use
d mechanism to retrieve a Recordset and open a connection for only the necessary
amount of time, thus increasing scalability. They are call disconnected because
the connection to the database is closed.
The collections, properties, and methods of a disconnected Recordset are still a
vailable even though the connection is closed. This frees up server resources, g
iven that the number of open connections is limited and database locking is a no
n-issue.
What are Benefits of wrapping database calls into MTS transactions?
If database calls are made within the context of a transaction, aborting the tra
nsaction will undo and changes that occur within that transaction.
This removes the possibility of stranded, or partial data. Transaction that uses
the Microsoft® Transaction Server (MTS) environment. MSMQ implicitly uses the cur
rent MTS transaction if one is available.
BENIFTIS OF USING MTS :
Database Pooling, Transactional operations, Deployment, Security, Remote Executi
on This allows MTS to reuse database connections. Database connections are put t
o ?sleep? As opposed to being created and destroyed and are activated upon reque
st.
What is the tool used to configure the port range and protocols for DCOM communi
cations?
DCOMCONFIG.EXE
What is a Type Library and what is it's purpose ?
The type library may represent another Visual Basic project, or any other execut
able component that