Vous êtes sur la page 1sur 6

http://www.docstoc.com/docs/9829477/Visual-basic-6-tutorial What is a server?

Servers are computers or processes generally dedicated to managing disk drives (file servers), printers (print servers), e-mail (e-mail servers), faxes (fax servers), etc. Because the term "server" can refer to different items, it can be confusing. A file server is a computer that shares files and hardware devices among users. A database server is a special piece of software that resides on the file server. This special software manages multiple users accessing common data. When using a database server, an application does not interact directly with files, but with the database server. STI Server is a database server.

What is a client?
A client is the second half of the client/server model. Clients rely on servers for resources or services, such as files, devices and even processing power. The workstation from which you operate the software is considered a client.

What is Client/Server Architecture?


Client/Server Architecture is a network architecture in which each computer or process on the network is either a client or a server. This architecture is sometimes referred to as a two-tier network architecture with the server being the first tier and the client being the second tier. Typically, there is a "one server" to "many clients" relationship. For example, an Internet Web Server is a server whereas the various browsers that connect to it are considered clients. Think of the client/server relationship in this way: a client requests services whereas a server provides services.

ADVANTAGES OF CLIENT-SERVER

Advantages often cited include:


Centralization - access, resources, and data security are controlled through the server o Scalability - any element can be upgraded when needed o Flexibility - new technology can be easily integrated into the system o Interoperability - all components (clients, network, servers) work together
o

Accessibility - server can be accessed remotely and across multiple platforms o Ease of application development o Lower total costs than mainframe legacy systems. o User friendly - familiar point and click interface
o

DISADVANTAGES OF CLIENT-SERVER
Disadvantages often cited include: o Dependability - when the server goes down, operations cease o Lack of mature tools - it is a relatively new technology and needed tools are lacking e.g.. Automated client software distribution o Lack of scalability - network operating systems (e.g.. Novell Netware, Windows NT Server) are not very scalable. o Higher than anticipated costs o Can cause network congestion

Client Server models


Client: It is a component which requests the server for information. For eg: PC is used in internet, workstations in LAN etc. Server: It is a component which provides the requested information to the client. For eg. Webserver, LAN servers etc. Network: It is the data transmission media. The type of transmission may be request for data or data transfer. There are two types of client server model. They are

Two tier model Three-tier model

a)Two-tier(client-Server) model: In this model there are two major components. They are

Front end client Back end server

Front end is application software which is present in the client machine. This component requests for data from the server. This contains number of drivers to connect with the different servers. Back end is RDBMS software which is present in the server machine. This component process the requests from the client and provides the data from the database. Disadvantages: Client must have a driver to access the server.If the client want to access the number of servers it should have drivers for all the servers. This is very costly because each driver carries a license fee. Software maintenance is costly. If the database vendors change the database design , the client must update the drivers. b)Three-tier Client server model: There are three major components. They are

front end client back end server Middleware

Front end is application software which is present in the client machine. This component requests for data to the middleware. This has no drivers. Instead has a single driver to interface the middleware. The Middleware component software process the request from the client. If it contains the requested data it sends immediately to the client. If the data requested is not present it requests the server for data. Middleware component contains number of drivers to connect with the various servers. Back end is RDBMS software which is present in the server machine. The component process the requests from the middleware and provides the data to the middleware. The middleware sends the data to the client. Advantages:

Client has no drivers. So cost effective. If the database vendors change the database design no need to update the client software. Security is high. More than one client can request the middleware for data.

Understanding and Optimizing Data Types


In Visual Basic 6 there are 11 different data types. These are Boolean, Byte, Currency, Date, Double, Integer, Long, Object, Single, String, and Variant. They each have a specific purpose and using them correctly will increase your programs performance. I am going to cover the data types most frequently used.

Boolean
The Boolean data type has only two states, True and False. These types of variables are stored as 16-bit (2 Byte) numbers, and are usually used for flags. For example, lets say that you have a textbox (Text1) and a command button (Command1). You only want Command1 to be Enabled when there is text in Text1. You would do something like this... Private Sub Form_Load() Command1.Enabled = False ' Disables Command1 Text1.Text = vbNullString ' Sets Text1="" End Sub Private Sub Text1_Change() Dim bEnable As Boolean If Text1.Text <> "" Then bEnable = True Command1.Enabled = bEnable End Sub Run the program and Command1 will only be enabled when there is text typed into Text1.

Byte
The Byte data type is an 8-bit variable which can store value from 0 to 255. This data type is very useful for storing binary data. It can also be very useful when sending/receiving byte values to/from a Basic Stamp or PIC.

Double
The Double data type is a 64-bit floating point number used when high accuracy is needed. These variables can range from -1.79769313486232e308 to -4.94065645841247e-324 for negative values and from 4.94065645841247e-324 to 1.79769313486232e308 for positive values.

Integer
The Integer data type is a 16-bit number which can range from -32768 to32767. Integers should be used when you are working with values that can not contain fractional numbers.

Long
The Long data type is a 32-bit number which can range from 2,147,483,648 to 2,147,483,647. Long variables can only contain non-fractional integer values. I myself use Long variables over Integers for increased performance. Most Win32 functions use this data type for this reason.

Single
The Single data type is a 32-bit number ranging from -3.402823e38 to -1.401298e-45 for negative values and from 1.401298e-45 to 3.402823e38 for positive values. When you need fractional numbers within this range, this is the data type to use.

String
The String data type is usually used as a variable-length type of variable. A variable-length string can contain up to approximately 2 billion characters. Each character has a value ranging from 0 to 255 based on the ASCII character set. Strings are used when Text is involved.

Putting All Of This Technical Stuff To Use


Just to show you how to use these data types, here is a small example. Lets say that we have a String containing the text, "This VB stuff is pretty darn cool..!", and we want to convert each letter to it's ASCII equivalent. We will then display each letter along with its ASCII equivalent in a MessageBox one at a time. Private Sub Command1_Click() Dim sText As String Dim lTextLength As Long Dim sChar As String Dim bASCII As Byte Dim x As Long sText = "This VB stuff is pretty darn cool..!" lTextLength = Len(sText) 'Gets # of chars in sText For x = 1 To lTextLength 'Loop through string one char at a time sChar = Mid$(sText, x, 1)'Gets the x'th charcter in sText bASCII = Asc(sChar) 'Gets ASCII value of character MsgBox "The ASCII value of '" & sChar & "' is " & bASCII 'Display results Next x End Sub Unit 4

File System Controls (DriveListBox, DirListBox, FileListBox) VB provides three native toolbox controls for working with the file system: the DriveListBox, DirListBox, and FileListBox. You can use these controls independently, or in concert with one another to navigate the file system. The DriveListBox control is a specialized drop-down list that displays a list of all the valid drives on the user's system. The most important property of the DriveListBox is the Drive property, which is set when the user selects an entry from the drop-down list or when you assign a drive string (such as "C:") to the Drive property in code. You can also read the Drive property to see which drive has been selected. To make a DirListBox display the directories of the currently selected drive, you would set the Path property of the DirListBox control to the Drive property of the DriveListBox control in the Change event of the DriveListBox, as in the following statement: Dir1.Path = Drive1.Drive The DirListBox control displays a hierarchical list of the user's disk directories and subdirectories and automatically reacts to mouse clicks to allow the user to navigate among them. To synchronize the path selected in the DirListBox with a FileListBox, assign the Path property of the DirListBox to the Path property of the FileListBox in the Change event of the DirListBox, as in the following statement: File1.Path = Dir1.Path

The FileListBox control lists files in the directory specified by its Path property. You can display all the files in the current directory, or you can use the Pattern property to show only certain types of files. Similar to the standard ListBox and ComboBox controls, you can reference the List, ListCount, and ListIndex properties to access items in a DriveListBox, DirListBox, or FileListBox control. In addition, the FileListBox has a MultiSelect property which may be set to allow multiple file selection.

Vous aimerez peut-être aussi