Restore and recover database
Invoke RMAN and set the DBID: We invoke rman and connect to the target database as usual. No login credentials are required since we connect from an OS account belonging to ORA_DBA. Note that RMAN accepts a connection to the database although the database is yet to be recovered. RMAN doesn't as yet "know" which database we intend to connect to. We therefore need to identify the (to be restored) database to RMAN. This is done through the database identifier (DBID). The DBID can be figured out from the name of the controlfile backup. Example: if you use the controlfile backup format suggested in Part I, your controlfile backup name will be something like "CTL_SP_BAK_C-1507972899-20050228-00". In this case the DBID is 1507972899. Here's a transcript illustrating the process of setting the DBID:
C:\>rman
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
RMAN> connect target /
connected to target database (not started)
RMAN> set dbid 1507972899
executing command: SET DBID
RMAN>
Restore spfile from backup: To restore the spfile, you first need to startup the database in the nomount state. This starts up the database using a dummy parameter file. After that you can restore the spfile from the backup (which has been restored from tape in Section 3). Finally you restart the database in nomount state. The restart is required in in order to start the instance using the restored parameter file. Here is an example RMAN transcript for the foregoing procedure. Note the difference in SGA size and components between the two startups:
RMAN> startup nomount
Oracle instance started
Total System Global Area 1520937712 bytes
Fixed Size 457456 bytes
Variable Size 763363328 bytes
Database Buffers 754974720 bytes
Redo Buffers 2142208 bytes
RMAN>
Restore control file from backup: The instance now "knows" where the control files should be restored, as this is listed in the CONTROL_FILES initialisation parameter. Therefore, the next step is to restore these files from backup. Once the control files are restored, the instance should be restarted in mount mode. A restart is required because the instance must read the initialisation parameter file in order to determine the control file locations. At the end of this step RMAN also has its proper configuration parameters, as these are stored in the control file.
Here is a RMAN session transcript showing the steps detailed here:
Example:
RMAN> restore controlfile from 'e:\backup\CTL_SP_BAK_C-1507972899-20050228-00';
Starting restore at 01/MAR/05
allocated channel: ORA_DISK_1
hannel ORA_DISK_1: sid=13 devtype=DISK
channel ORA_DISK_1: restoring controlfile
channel ORA_DISK_1: restore complete
replicating controlfile
input filename=D:\ORACLE_DATA\CONTROLFILE\ORCL\CONTROL01.CTL
output filename=E:\ORACLE_DATA\CONTROLFILE\ORCL\CONTROL02.CTL
output filename=C:\ORACLE_DUP_DEST\CONTROLFILE\ORCL\CONTROL03.CTL
Finished restore at 01/MAR/05
RMAN> shutdown
Oracle instance shut down
RMAN> exit
Recovery Manager complete.
C:\>rman target /
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
database mounted
Total System Global Area 1520937712 bytes
Fixed Size 457456 bytes
Variable Size 763363328 bytes
Database Buffers 754974720 bytes
Redo Buffers 2142208 bytes
RMAN> restore database;
Starting restore at 01/MAR/05
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=8 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to D:\ORACLE_DATA\DATAFILES\ORCL\SYSTEM01.DBF
restoring datafile 00003 to D:\ORACLE_DATA\DATAFILES\ORCL\USERS01.DBF
restoring datafile 00004 to D:\ORACLE_DATA\DATAFILES\ORCL\USERS02.DBF
channel ORA_DISK_2: starting datafile backupset restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
restoring datafile 00002 to D:\ORACLE_DATA\DATAFILES\ORCL\UNDOTBS01.DBF
restoring datafile 00005 to D:\ORACLE_DATA\DATAFILES\ORCL\TOOLS01.DBF
restoring datafile 00006 to D:\ORACLE_DATA\DATAFILES\ORCL\TOOLS02.DBF
channel ORA_DISK_2: restored backup piece 1
piece handle=E:\BACKUP\80G6E1TT_1_1.BAK tag=TAG20041130T222501 params=NULL
channel ORA_DISK_1: restored backup piece 1
piece handle=E:\BACKUP\81G6E1TU_1_1.BAK tag=TAG20041130T222501 params=NULL
channel ORA_DISK_2: restored backup piece 2
piece handle=E:\BACKUP\80G6E1TT_2_1.BAK tag=TAG20041130T222501 params=NULL
channel ORA_DISK_1: restored backup piece 2
piece handle=E:\BACKUP\81G6E1TU_2_1.BAK tag=TAG20041130T222501 params=NULL
channel ORA_DISK_1: restored backup piece 3
piece handle=E:\BACKUP\81G6E1TU_3_1.BAK tag=TAG20041130T222501 params=NULL
channel ORA_DISK_1: restore complete
channel ORA_DISK_2: restored backup piece 3
piece handle=E:\BACKUP\80G6E1TT_3_1.BAK tag=TAG20041130T222501 params=NULL
channel ORA_DISK_2: restore complete
Finished restore at 01/MAR/05
RMAN> recover database;
Starting recover at 01/MAR/05
using channel ORA_DISK_1
using channel ORA_DISK_2
starting media recovery
unable to find archive log archive log thread=1 sequence=1388
RMAN-00571: ==============================
RMAN-00569: =ERROR MESSAGE STACK FOLLOWS =
RMAN-00571: ===============================
RMAN-03002: failure of recover command at 04/01/2005 14:14:43
RMAN-06054: media recovery requesting unknown log: thread 1 scn 32230460
RMAN> alter database open resetlogs;
Database opened
Step -1
Open the cmd prompt enter the RMAN command, before perform the rman make a note on database id
C:\>rman target /
rman> show all;
rman> CONFIGURE CONTROLFILE AUTOBACKUP ON;
rman> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/(put backup directory here)/autobackup_control_file%F’;
Step -2
Create the backup folder which is all the backed up files will be stored in this area
Example
C:\backup_area
Step -3
Use this script to take a complete database backup including archive and controlfiles
before executing the script spool output to preferred location.
RMAN > spool log to c:\rman_bkp.log
RMAN> run {
ALLOCATE CHANNEL RMAN_BACK_CH01 TYPE DISK;
CROSSCHECK BACKUP;
BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT 'c:\bkp\databasefiles_%d_%u_%s_%T';
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT 'c:\bkp\archivelogs_%d_%u_%s_%T'DELETE INPUT;
BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FORMAT 'c:\bkp\controlfile_%d_%u_%s_%T';
RELEASE CHANNEL RMAN_BACK_CH01;
}
RMAN>Spool off
RMAN>exit
Step -4
Open the rman_bkp log file in the c:\ and make a note of handle piece of control file this will be used for restore and recovery purpose.
DBID=4198793586
Monday, November 30, 2009
ORACLE : Configuring Database Control with EMCA
Steps to manually configure Entreprise Manager Control to manually created database.
This file extracted from the link given at the bottom if you need more details refer that link
Configuring Database Control with EMCA
When you use DBCA to configure Oracle Database 10g, DBCA provides a graphical user interface to help you select Database Control options and to configure other aspects of your database.
However, if you want to use the operating system command line to configure Database Control, you can use the Enterprise Manager Configuration Assistant (EMCA).
To configure Database Control with EMCA:
1. Set the following environment variables to identify the Oracle home and the system identifier (SID) for the database you want to manage:
o ORACLE_HOME
o ORACLE_SID
2. Change directory to the ORACLE_HOME/bin directory.
3. Start EMCA by entering the following command with any of the optional command-line arguments shown in Table 1-3:
4. $PROMPT> ./emca
5.
Depending upon the arguments you include on the EMCA command line, EMCA prompts you for the information required to configure Database Control.
For example, enter the following command to configure Database Control so it will perform automatic daily backups of your database:
$PROMPT> ./emca -config dbcontrol db -backup
EMCA commands are of the form:
emca [operation] [mode] [flags] [parameters]
Note: [once manually create database ue this commands to create repository for Entreprise Manager to that particular database and the configure with enterprie manager]
To configure Database Console for single instance database using ASM, no extra parameters need to be passed along with the EMCA command. Run the following command to configure the Database Console which will automatically detect the ASM instance:
emca -config dbcontrol db -repos create
Table 1-3 describes the valid execution operations and modes, and lists the optional parameters in brackets. Table 1-4 discusses the flags and their behavior, while Table 1-5 defines the optional parameters in detail. EMCA parameters are of the form [ -parameterName parameterValue ]. Multiple parameters can be used in combination at the command line.
Table 1-3 EMCA Command-Line Operations
Command Description
emca -h | --h | -help | --help Use this option to display the Help message for the EMCA utility. The options described in Table 1-3, Table 1-4, andTable 1-5, and the valid parameters you may include are listed.
emca –version Prints the version information associated with EMCA.
emca -config dbcontrol db [-repos (create | recreate)] [-cluster] [-silent] [-backup] [parameters] Configures Database Control for a database. Options include creating (or recreating) Database Control repository, configuring automatic backups, and performing these operations on a cluster database.
emca -config centralAgent (db | asm) [-cluster] [-silent] [parameters] Configures central agent management for a database or an Automatic Storage Management (ASM) instance. Options include performing this operation on a cluster environment.This operation will configure the database so that it can be centrally managed by the Oracle Enterprise Manager 10g Grid Control Console. To use this option, you must have previously installed the Oracle Management Service component of Enterprise Manager on a network host. In addition, the Oracle Management Agent must be installed on the host where you are running the database.
emca -config all db [-repos (create | recreate)] [-cluster] [-silent] [-backup] [parameters] Configures both Database Control and central agent management for a database. The possible configuration options are similar to those described above.
emca -deconfig dbcontrol db [-repos drop] [-cluster] [-silent] [parameters] Deconfigures Database Control for a database. Options include dropping the Database Control repository and performing these operations on a cluster database. For example, you might use this command to remove the Database Control configuration from a database you are planning to delete. In such a scenario, remove the Database Control configuration before physically deleting the database. This operation does not remove the actual database or its data files.
emca -deconfig centralAgent (db | asm) [-cluster] [ -silent] [parameters] Deconfigures central agent management for a database or an ASM instance. Options include performing this operation on a cluster environment. For example, you might use this command to remove the central agent management configuration from a database you are planning to delete. In such a scenario, remove the central agent management configuration before physically deleting the database. This operation does not remove the actual database or its data files.
emca -deconfig all db [-repos drop] [-cluster] [-silent] [parameters] Deconfigures both Database Control and central agent management for a database. The possible deconfiguration options are similar to those described above.
emca -addInst (db | asm) [-silent] [parameters] Configures Enterprise Manager for a new cluster instance of a database or ASM storage. For more information, refer to Section 1.2.6.5.
emca -deleteInst (db | asm) [-silent] [parameters] Deconfigures Enterprise Manager for a specific instance of a cluster database or ASM storage. This is discussed further below, in Section 1.2.6.5.
emca -reconfig ports [-cluster] [parameters] Explicitly reassigns Database Control ports. Options include performing this operation on a cluster environment. For more information, refer to Section 1.2.6.6.
emca -reconfig dbcontrol -cluster [-silent] [parameters] Reconfigures Database Control deployment for a cluster database. Note that this command must be used with the "-cluster" option. For more information, refer to Section 1.2.6.5.
emca -displayConfig dbcontrol -cluster [-silent] [parameters] Displays information about the current deployment configuration of Database Control in a cluster environment. Note that this command must be used with the "-cluster" option. For more information, refer to Section 1.2.6.5.
emca -upgrade (db | asm | db_asm) [-cluster] [-silent] [parameters] Upgrades the configuration of an earlier version of Enterprise Manager to the current version. This operation can be performed for database, ASM, or database and ASM instances together simultaneously. This does not upgrade the actual database or ASM instances, nor does it upgrade the Enterprise Manager software. Instead, it upgrades the configuration files for the specified instance so that they are compatible with the current version of the Enterprise Manager software. EMCA will attempt to upgrade all instances of the specified database and/or ASM target on the host, across all Oracle Homes (since it is likely that certain target properties, such as listener port or Oracle Home, have changed).
emca -restore (db | asm | db_asm) [-cluster] [-silent] [parameters] Restores the current version of Enterprise Manager configuration to an earlier version. This is the inverse of the "-upgrade" option (and will reverse any changes that result from an "-upgrade" operation), and as such, the options are similar.
Table 1-4 EMCA Command-Line Flags
Flag Description
Db Performs the operation for a database (including cluster databases). Use this option for databases that use Automatic Storage Management (ASM) to store the data files. If a database is using ASM, all the configuration operations and modes described above (except for "-upgrade" and "-restore") will detect this automatically and apply the changes to both the database and ASM instance(s).
Asm Performs the operation for an ASM-only instance (including cluster ASM instances).
db_asm This flag can only be used in "-upgrade" and "-restore" mode. Performs the upgrade/restore operation for a database and an ASM instance together. Database and ASM instances may be upgraded or restored separately (that is, upgrading an ASM instance does not require upgrading the database instances it services). Hence, the Enterprise Manager configuration can be upgraded or restored separately for a database and its respective ASM instance.
-repos create Creates a new Database Control management repository.
-repos drop Drops the current Database Control management repository.
-repos recreate Drops the current Database Control management repository and then recreates a new one.
-cluster Performs the operation for a cluster database or ASM instance.
-silent Performs the operation without prompting for additional information. If this mode is specified, all the required parameters must be entered at the command line or specified in an input file using the –respFile argument. You can view a list of the available parameters by entering emca -help at the command line.
-backup Configures automatic backup for a database. EMCA will prompt for daily automatic backup options. The default Enterprise Manager settings will be used to backup the database files.Note: If you use this option, EMCA will use the value of the db_recovery_file_dest initialization parameter to identify the flashback recovery area for the automated backups. If that parameter is not set, EMCA will generate an error. You can modify these settings later using the Maintenance page in Database Control. For more information, see the Database Control online Help.
Table 1-5 EMCA Command-Line Parameters
Parameter Description
-respFile Specifies the path of an input file listing parameters for EMCA to use while performing its configuration operation. For more information, refer to Section 1.2.6.4.
-SID Database system identifier
-PORT Port number for the listener servicing the database
-ORACLE_HOME Database Oracle Home, as an absolute path
-LISTENER_OH Oracle Home from where the listener is running. If the listener is running from an Oracle Home other than the one on which the database is running, the parameter LISTENER_OH must be specified.
-HOST_USER Host machine user name (for automatic backup)
-HOST_USER_PWD Host machine user password (for automatic backup)
-BACKUP_SCHEDULE Schedule in the form of "HH:MM" (for daily automatic backups)
-EMAIL_ADDRESS E-mail address for notifications
-MAIL_SERVER_NAME Outgoing Mail (SMTP) server for notifications
-ASM_OH Automatic Storage Management Oracle Home
-ASM_SID System identifier for ASM instance
-ASM_PORT Port number for the listener servicing the ASM instance
-ASM_USER_ROLE User role for connecting to the ASM instance
-ASM_USER_NAME User name for connecting to the ASM instance
-ASM_USER_PWD Password for connecting to the ASM instance
-DBSNMP_PWD Password for DBSNMP user
-SYSMAN_PWD Password for SYSMAN user
-SYS_PWD Password for SYS user
-SRC_OH Oracle Home of the database with Enterprise Manager configuration to be upgraded/restored
-DBCONTROL_HTTP_PORT Use this parameter to specify the port you use to display the Database Control Console in your Web browser. For more information, refer to Section 1.2.6.6.
-AGENT_PORT Use this parameter to specify the Management Agent port for Database Control. For more information, refer to Section 1.2.6.6.
-RMI_PORT Use this parameter to specify the RMI port for Database Control. For more information, refer to Section 1.2.6.6.
-JMS_PORT Use this parameter to specify the JMS port for Database Control. For more information, refer to Section 1.2.6.6.
-CLUSTER_NAME Cluster name (for cluster databases)
-DB_UNIQUE_NAME Database unique name (for cluster databases)
-SERVICE_NAME Database service name (for cluster databases)
-EM_NODE Node from which Database Control console is to be run (for cluster databases). For more information, refer to Section 1.2.6.5.
-EM_SID_LIST Comma-separated list of SIDs for agent-only configurations, uploading data to –EM_NODE. For more information, refer to Section 1.2.6.5.
1.2.6.4 Using an Input File for EMCA Parameters
Instead of answering a series of prompts when you run EMCA, you can use the -respFile argument to specify an input file. The input file you create must be in a format similar to the following example:
PORT=1521
SID=DB
DBSNMP_PWD=xpE234D
SYSMAN_PWD=KDOdk432
After you create an EMCA input file, you can use it on the command line as follows:
$PROMPT> ./emca -config dbcontrol db -respFile input_file_path
For example, to configure the Database Control to perform daily backups and create the Database Control Management Repository, create an input file similar to the one shown in and enter the following command at the operating system prompt:
$PROMPT> ./emca -config dbcontrol db -repos create -backup -respFile input_file_path
Example 1-1 EMCA Input File that Configures Database Control for Automatic Backup and Creates the Database Control Management Repository
PORT=1521
SID=DB
DBSNMP_PWD=dow3l224
SYSMAN_PWD=squN3243
HOST_USER=johnson
HOST_USER_PWD=diTf32of
SYS_PWD=qlKj4352
BACKUP_SCHEDULE=06:30
http://download.oracle.com/docs/cd/B19306_01/em.102/b40002/structure.htm#sthref73
This file extracted from the link given at the bottom if you need more details refer that link
Configuring Database Control with EMCA
When you use DBCA to configure Oracle Database 10g, DBCA provides a graphical user interface to help you select Database Control options and to configure other aspects of your database.
However, if you want to use the operating system command line to configure Database Control, you can use the Enterprise Manager Configuration Assistant (EMCA).
To configure Database Control with EMCA:
1. Set the following environment variables to identify the Oracle home and the system identifier (SID) for the database you want to manage:
o ORACLE_HOME
o ORACLE_SID
2. Change directory to the ORACLE_HOME/bin directory.
3. Start EMCA by entering the following command with any of the optional command-line arguments shown in Table 1-3:
4. $PROMPT> ./emca
5.
Depending upon the arguments you include on the EMCA command line, EMCA prompts you for the information required to configure Database Control.
For example, enter the following command to configure Database Control so it will perform automatic daily backups of your database:
$PROMPT> ./emca -config dbcontrol db -backup
EMCA commands are of the form:
emca [operation] [mode] [flags] [parameters]
Note: [once manually create database ue this commands to create repository for Entreprise Manager to that particular database and the configure with enterprie manager]
To configure Database Console for single instance database using ASM, no extra parameters need to be passed along with the EMCA command. Run the following command to configure the Database Console which will automatically detect the ASM instance:
emca -config dbcontrol db -repos create
Table 1-3 describes the valid execution operations and modes, and lists the optional parameters in brackets. Table 1-4 discusses the flags and their behavior, while Table 1-5 defines the optional parameters in detail. EMCA parameters are of the form [ -parameterName parameterValue ]. Multiple parameters can be used in combination at the command line.
Table 1-3 EMCA Command-Line Operations
Command Description
emca -h | --h | -help | --help Use this option to display the Help message for the EMCA utility. The options described in Table 1-3, Table 1-4, andTable 1-5, and the valid parameters you may include are listed.
emca –version Prints the version information associated with EMCA.
emca -config dbcontrol db [-repos (create | recreate)] [-cluster] [-silent] [-backup] [parameters] Configures Database Control for a database. Options include creating (or recreating) Database Control repository, configuring automatic backups, and performing these operations on a cluster database.
emca -config centralAgent (db | asm) [-cluster] [-silent] [parameters] Configures central agent management for a database or an Automatic Storage Management (ASM) instance. Options include performing this operation on a cluster environment.This operation will configure the database so that it can be centrally managed by the Oracle Enterprise Manager 10g Grid Control Console. To use this option, you must have previously installed the Oracle Management Service component of Enterprise Manager on a network host. In addition, the Oracle Management Agent must be installed on the host where you are running the database.
emca -config all db [-repos (create | recreate)] [-cluster] [-silent] [-backup] [parameters] Configures both Database Control and central agent management for a database. The possible configuration options are similar to those described above.
emca -deconfig dbcontrol db [-repos drop] [-cluster] [-silent] [parameters] Deconfigures Database Control for a database. Options include dropping the Database Control repository and performing these operations on a cluster database. For example, you might use this command to remove the Database Control configuration from a database you are planning to delete. In such a scenario, remove the Database Control configuration before physically deleting the database. This operation does not remove the actual database or its data files.
emca -deconfig centralAgent (db | asm) [-cluster] [ -silent] [parameters] Deconfigures central agent management for a database or an ASM instance. Options include performing this operation on a cluster environment. For example, you might use this command to remove the central agent management configuration from a database you are planning to delete. In such a scenario, remove the central agent management configuration before physically deleting the database. This operation does not remove the actual database or its data files.
emca -deconfig all db [-repos drop] [-cluster] [-silent] [parameters] Deconfigures both Database Control and central agent management for a database. The possible deconfiguration options are similar to those described above.
emca -addInst (db | asm) [-silent] [parameters] Configures Enterprise Manager for a new cluster instance of a database or ASM storage. For more information, refer to Section 1.2.6.5.
emca -deleteInst (db | asm) [-silent] [parameters] Deconfigures Enterprise Manager for a specific instance of a cluster database or ASM storage. This is discussed further below, in Section 1.2.6.5.
emca -reconfig ports [-cluster] [parameters] Explicitly reassigns Database Control ports. Options include performing this operation on a cluster environment. For more information, refer to Section 1.2.6.6.
emca -reconfig dbcontrol -cluster [-silent] [parameters] Reconfigures Database Control deployment for a cluster database. Note that this command must be used with the "-cluster" option. For more information, refer to Section 1.2.6.5.
emca -displayConfig dbcontrol -cluster [-silent] [parameters] Displays information about the current deployment configuration of Database Control in a cluster environment. Note that this command must be used with the "-cluster" option. For more information, refer to Section 1.2.6.5.
emca -upgrade (db | asm | db_asm) [-cluster] [-silent] [parameters] Upgrades the configuration of an earlier version of Enterprise Manager to the current version. This operation can be performed for database, ASM, or database and ASM instances together simultaneously. This does not upgrade the actual database or ASM instances, nor does it upgrade the Enterprise Manager software. Instead, it upgrades the configuration files for the specified instance so that they are compatible with the current version of the Enterprise Manager software. EMCA will attempt to upgrade all instances of the specified database and/or ASM target on the host, across all Oracle Homes (since it is likely that certain target properties, such as listener port or Oracle Home, have changed).
emca -restore (db | asm | db_asm) [-cluster] [-silent] [parameters] Restores the current version of Enterprise Manager configuration to an earlier version. This is the inverse of the "-upgrade" option (and will reverse any changes that result from an "-upgrade" operation), and as such, the options are similar.
Table 1-4 EMCA Command-Line Flags
Flag Description
Db Performs the operation for a database (including cluster databases). Use this option for databases that use Automatic Storage Management (ASM) to store the data files. If a database is using ASM, all the configuration operations and modes described above (except for "-upgrade" and "-restore") will detect this automatically and apply the changes to both the database and ASM instance(s).
Asm Performs the operation for an ASM-only instance (including cluster ASM instances).
db_asm This flag can only be used in "-upgrade" and "-restore" mode. Performs the upgrade/restore operation for a database and an ASM instance together. Database and ASM instances may be upgraded or restored separately (that is, upgrading an ASM instance does not require upgrading the database instances it services). Hence, the Enterprise Manager configuration can be upgraded or restored separately for a database and its respective ASM instance.
-repos create Creates a new Database Control management repository.
-repos drop Drops the current Database Control management repository.
-repos recreate Drops the current Database Control management repository and then recreates a new one.
-cluster Performs the operation for a cluster database or ASM instance.
-silent Performs the operation without prompting for additional information. If this mode is specified, all the required parameters must be entered at the command line or specified in an input file using the –respFile argument. You can view a list of the available parameters by entering emca -help at the command line.
-backup Configures automatic backup for a database. EMCA will prompt for daily automatic backup options. The default Enterprise Manager settings will be used to backup the database files.Note: If you use this option, EMCA will use the value of the db_recovery_file_dest initialization parameter to identify the flashback recovery area for the automated backups. If that parameter is not set, EMCA will generate an error. You can modify these settings later using the Maintenance page in Database Control. For more information, see the Database Control online Help.
Table 1-5 EMCA Command-Line Parameters
Parameter Description
-respFile Specifies the path of an input file listing parameters for EMCA to use while performing its configuration operation. For more information, refer to Section 1.2.6.4.
-SID Database system identifier
-PORT Port number for the listener servicing the database
-ORACLE_HOME Database Oracle Home, as an absolute path
-LISTENER_OH Oracle Home from where the listener is running. If the listener is running from an Oracle Home other than the one on which the database is running, the parameter LISTENER_OH must be specified.
-HOST_USER Host machine user name (for automatic backup)
-HOST_USER_PWD Host machine user password (for automatic backup)
-BACKUP_SCHEDULE Schedule in the form of "HH:MM" (for daily automatic backups)
-EMAIL_ADDRESS E-mail address for notifications
-MAIL_SERVER_NAME Outgoing Mail (SMTP) server for notifications
-ASM_OH Automatic Storage Management Oracle Home
-ASM_SID System identifier for ASM instance
-ASM_PORT Port number for the listener servicing the ASM instance
-ASM_USER_ROLE User role for connecting to the ASM instance
-ASM_USER_NAME User name for connecting to the ASM instance
-ASM_USER_PWD Password for connecting to the ASM instance
-DBSNMP_PWD Password for DBSNMP user
-SYSMAN_PWD Password for SYSMAN user
-SYS_PWD Password for SYS user
-SRC_OH Oracle Home of the database with Enterprise Manager configuration to be upgraded/restored
-DBCONTROL_HTTP_PORT Use this parameter to specify the port you use to display the Database Control Console in your Web browser. For more information, refer to Section 1.2.6.6.
-AGENT_PORT Use this parameter to specify the Management Agent port for Database Control. For more information, refer to Section 1.2.6.6.
-RMI_PORT Use this parameter to specify the RMI port for Database Control. For more information, refer to Section 1.2.6.6.
-JMS_PORT Use this parameter to specify the JMS port for Database Control. For more information, refer to Section 1.2.6.6.
-CLUSTER_NAME Cluster name (for cluster databases)
-DB_UNIQUE_NAME Database unique name (for cluster databases)
-SERVICE_NAME Database service name (for cluster databases)
-EM_NODE Node from which Database Control console is to be run (for cluster databases). For more information, refer to Section 1.2.6.5.
-EM_SID_LIST Comma-separated list of SIDs for agent-only configurations, uploading data to –EM_NODE. For more information, refer to Section 1.2.6.5.
1.2.6.4 Using an Input File for EMCA Parameters
Instead of answering a series of prompts when you run EMCA, you can use the -respFile argument to specify an input file. The input file you create must be in a format similar to the following example:
PORT=1521
SID=DB
DBSNMP_PWD=xpE234D
SYSMAN_PWD=KDOdk432
After you create an EMCA input file, you can use it on the command line as follows:
$PROMPT> ./emca -config dbcontrol db -respFile input_file_path
For example, to configure the Database Control to perform daily backups and create the Database Control Management Repository, create an input file similar to the one shown in and enter the following command at the operating system prompt:
$PROMPT> ./emca -config dbcontrol db -repos create -backup -respFile input_file_path
Example 1-1 EMCA Input File that Configures Database Control for Automatic Backup and Creates the Database Control Management Repository
PORT=1521
SID=DB
DBSNMP_PWD=dow3l224
SYSMAN_PWD=squN3243
HOST_USER=johnson
HOST_USER_PWD=diTf32of
SYS_PWD=qlKj4352
BACKUP_SCHEDULE=06:30
http://download.oracle.com/docs/cd/B19306_01/em.102/b40002/structure.htm#sthref73
Sunday, November 29, 2009
BUSINESS ETHIC AND VALUE : EVOLUTION OF MORAL AND ETHICAL THOUGHTS
EVOLUTION OF MORAL AND ETHICAL THOUGHTS
-ANCIENT PHILOSOPHY
-RELIGIONS AND CUSTOMS
-RATIONALIST PHILOSOPHY
-CONTEMPORARY THOUGHTS
ANCIENT PHILOSOPHY
-The Beginning of Ethical Thoughts
-Virtue Ethics
-Cultivating Virtues and Education
The Beginning of Ethical Thoughts
-The ethical thoughts Socrates and Plato are believed to mold the early principles of ethics
-Socrates' ethical thoughts are important in bringing out the correct insights and conscience in men.
-According to Socrates, the decision-making process goes through four levels to ensure an ethical decision is made:
--reasoning and deliberation
--reflect
--choice
--aware of responsibility
-Socrates added that a good person is a rational individual.
-In order to be a rational individual, a person's personality and character is important.
-Knowledge plays an important role in shaping and developing a person's personality.
-According to Socrates, ethical thoughts begin when we are guided by conscience.
-According to Plato, the foundation of being ethical is the understanding of what a good life is and what is right.
-He believes that evil is due to lack of knowledge. This means that if a person is aware of good actions and understands what a good life is, then he is moving towards being an ethical person. If he lacks knowledge, he will not be able to distinguish the right from the wrong, which could cause him to do wrong.
The ethical thoughts of Plato:
-knowledge
-nature of good life
-developing virtuous habits and mental powers
-guidance
-goodness
Plato also pointed out that men do not have a simple essence or form. They are made up of several elements with their own natural capacity and function. According to Plato, men have three main elements. They are:
-the power to use language and to reason (highest level)
-the spirited element or the emotional drives (intermediate level)
-bodily appetites, desires, and needs (bottom level)
----Tripartite Theory----
Virtue Ethics
-In the simplest terms, virtue is something good while vice is not
-According to Aristotle, the foundation of morality and/or virtues is the development of good character traits. This entails that a good person has virtues and lacks vices.
-So, virtue here refers to good traits or characteristics such as courage, fairness, and honesty while vice refers to bad character traits like unfairness, cowardice and vanity.
-Ethics of virtues based on Aristotelian approach stresses the importance of judgement, virtues, and the character of an individual
-In Aristotelian ethics, the meaning of virtue is excellence in life and the development of a person towards becoming a morally good person.
-Virtue is divided into two categories as such:
--intellectual - philosophical wisdom, understanding and reasoning, and
--moral - self control of bodily desires and temptations by reason or intellect.
-According to Aristotle, humans are looked at as rational social beings that communicate and are always in touch with the society. The character of a person is the combination of his or her virtues and vices. This is because the virtues and vices will influence how we react to situations and problems and how we make decisions.
Cultivating Virtues and Education
-"We are what we repeatedly do. Excellence, then, is not an act but a habit." - Aristotle (384-322 B.C.)
-Virtue cultivation and education is necessary to ensure that ethical decisions are made and ethical principles followed
-Moral virtues are portrayed through habits and behavior. So, to instill moral virtues, one has to learn the virtues and practice them
-Intellectual virtues consist of philosophical knowledge, wisdom and understanding. These virtues are instilled through education.
RELIGIONS AND CUSTOMS
-Islamic ethics
-Christian ethics
-Confucian ethics
-Hindu ethics
-Buddhist ethics
-Similar values in religions
Islamic Ethics
-Islam is a religion that was brought to the people of the world through Allah's messengers and Prophet Muhammad (p.b.u.h.) is known to be the Final Messenger
-It believes in the oneness, uniqueness, incomparability and mercifulness of the one god, Allah
-The Qur'an and Hadiths serve as guides to Muslim ethical codes
-The foremost requirements of being Muslims are belief in the five pillars of Islam and the six pillars of faith
Ethical values in Islam:
--accountability for own actions,
--helping the poor,
--equality regardless of race, gender and economic or social status,
--sincerity and honesty, and
--respect of others.
Christian Ethics
-Jesus first brought the religion to the people of the world through his teachings in the Bible
-Sources of Christian ethics; Pastoral ethics and Church ethics
-In terms of application, Christian ethics covers areas like family, marriage, economy, and politics, which aims at individual and social well being.
A few examples of good deed according to Christian ethics are:
--feeding the hungry,
--clothing the poor, and
--basically helping out other Christians.
Some of those negatively granted are:
--stealing,
--adultery,
--lying, and
--killing.
Confucian Ethics
-Confucius was born in Shantung, China in 551 B.C
-Confucius believed that spiritual satisfaction comes from harmony in nature
-According to Confucius, customs will never end and that a nation can be correctly guided only by customs, not by knowledge
-Confucius did not differentiate customs, morality and justice because he saw the three as having a clear common root
-Everything that is natural has its own place, role and importance and nothing can deny it
-Human relations are based on values like love, respect, loyalty, sacrifice, and trust
Hindu Ethics
-Four Sanskrit Vedas are believed to initiate Hinduism. The word Hindu is of ancient Persian origin
-Three main ethical concepts:
Dharma
duty to perform an action, carry out responsibilities without thinking about personal rewards. Work taken as sacred
Unpanishad
means to sacrifice for the organization/others
Karma
action will incur reaction
do good~ get rewards
do bad~ get punishment
Buddhist Ethics
Buddhism was founded by Siddhartha Gautama, also known as Buddha, which means the Enlightened
Ethics principles:
The Four Noble Truths:
concerns sufferings and the cessation of desire
The Noble Eightfold Path
concerns morality, meditation and wisdom
The Precept
refraining five things: causing injury; sexual immorality; falsehood; alcohol indulgence; stealing
The Four Noble Truths:
life is a suffering,
suffering is due to attachment
attachment can be overcome
there is a path for overcoming the attachment,
The Noble Eightfold Path:
Right View
Right Aspiration
Right Speech
Right Action
Right Livelihood
Right Effort
Right Mindfulness
Right Concentration.
Similar Values in Religions
-Support Good Ethics
-Be Responsible
-Uphold Justice
-Sustaining Human Relationships
RATIONALIST PHILOSOPHY
=Human thinking and reasoning are the bases for arriving at truth and in the same breath, right and wrong actions
=Rational theories:
Ethical Egoism - advocates individualistic decision-making
Utilitarian Principle - considers right and wrong actions based on the net benefits that the action brings to the society after taking into account the evaluation of all parties affected by the decision in terms of benefits and costs
Kantian Theory - we should carry out moral actions because it is our duty to do so and not because we want or are inclined to, or because the benefits outweigh the costs
CONTEMPORARY THOUGHTS
John Rawls - considered rights and obligations in his consequentialist theory of justice
Nozick - believed in the theory of entitlement, which partially says that everyone has the privilege to what they have acquired legally and justly
Ross - righteousness as important in fulfilling moral obligations or duties that are more urgent than others
Alisdair McIntyre - virtue or character is an acquired human quality that enables individuals to achieve happiness
-ANCIENT PHILOSOPHY
-RELIGIONS AND CUSTOMS
-RATIONALIST PHILOSOPHY
-CONTEMPORARY THOUGHTS
ANCIENT PHILOSOPHY
-The Beginning of Ethical Thoughts
-Virtue Ethics
-Cultivating Virtues and Education
The Beginning of Ethical Thoughts
-The ethical thoughts Socrates and Plato are believed to mold the early principles of ethics
-Socrates' ethical thoughts are important in bringing out the correct insights and conscience in men.
-According to Socrates, the decision-making process goes through four levels to ensure an ethical decision is made:
--reasoning and deliberation
--reflect
--choice
--aware of responsibility
-Socrates added that a good person is a rational individual.
-In order to be a rational individual, a person's personality and character is important.
-Knowledge plays an important role in shaping and developing a person's personality.
-According to Socrates, ethical thoughts begin when we are guided by conscience.
-According to Plato, the foundation of being ethical is the understanding of what a good life is and what is right.
-He believes that evil is due to lack of knowledge. This means that if a person is aware of good actions and understands what a good life is, then he is moving towards being an ethical person. If he lacks knowledge, he will not be able to distinguish the right from the wrong, which could cause him to do wrong.
The ethical thoughts of Plato:
-knowledge
-nature of good life
-developing virtuous habits and mental powers
-guidance
-goodness
Plato also pointed out that men do not have a simple essence or form. They are made up of several elements with their own natural capacity and function. According to Plato, men have three main elements. They are:
-the power to use language and to reason (highest level)
-the spirited element or the emotional drives (intermediate level)
-bodily appetites, desires, and needs (bottom level)
----Tripartite Theory----
Virtue Ethics
-In the simplest terms, virtue is something good while vice is not
-According to Aristotle, the foundation of morality and/or virtues is the development of good character traits. This entails that a good person has virtues and lacks vices.
-So, virtue here refers to good traits or characteristics such as courage, fairness, and honesty while vice refers to bad character traits like unfairness, cowardice and vanity.
-Ethics of virtues based on Aristotelian approach stresses the importance of judgement, virtues, and the character of an individual
-In Aristotelian ethics, the meaning of virtue is excellence in life and the development of a person towards becoming a morally good person.
-Virtue is divided into two categories as such:
--intellectual - philosophical wisdom, understanding and reasoning, and
--moral - self control of bodily desires and temptations by reason or intellect.
-According to Aristotle, humans are looked at as rational social beings that communicate and are always in touch with the society. The character of a person is the combination of his or her virtues and vices. This is because the virtues and vices will influence how we react to situations and problems and how we make decisions.
Cultivating Virtues and Education
-"We are what we repeatedly do. Excellence, then, is not an act but a habit." - Aristotle (384-322 B.C.)
-Virtue cultivation and education is necessary to ensure that ethical decisions are made and ethical principles followed
-Moral virtues are portrayed through habits and behavior. So, to instill moral virtues, one has to learn the virtues and practice them
-Intellectual virtues consist of philosophical knowledge, wisdom and understanding. These virtues are instilled through education.
RELIGIONS AND CUSTOMS
-Islamic ethics
-Christian ethics
-Confucian ethics
-Hindu ethics
-Buddhist ethics
-Similar values in religions
Islamic Ethics
-Islam is a religion that was brought to the people of the world through Allah's messengers and Prophet Muhammad (p.b.u.h.) is known to be the Final Messenger
-It believes in the oneness, uniqueness, incomparability and mercifulness of the one god, Allah
-The Qur'an and Hadiths serve as guides to Muslim ethical codes
-The foremost requirements of being Muslims are belief in the five pillars of Islam and the six pillars of faith
Ethical values in Islam:
--accountability for own actions,
--helping the poor,
--equality regardless of race, gender and economic or social status,
--sincerity and honesty, and
--respect of others.
Christian Ethics
-Jesus first brought the religion to the people of the world through his teachings in the Bible
-Sources of Christian ethics; Pastoral ethics and Church ethics
-In terms of application, Christian ethics covers areas like family, marriage, economy, and politics, which aims at individual and social well being.
A few examples of good deed according to Christian ethics are:
--feeding the hungry,
--clothing the poor, and
--basically helping out other Christians.
Some of those negatively granted are:
--stealing,
--adultery,
--lying, and
--killing.
Confucian Ethics
-Confucius was born in Shantung, China in 551 B.C
-Confucius believed that spiritual satisfaction comes from harmony in nature
-According to Confucius, customs will never end and that a nation can be correctly guided only by customs, not by knowledge
-Confucius did not differentiate customs, morality and justice because he saw the three as having a clear common root
-Everything that is natural has its own place, role and importance and nothing can deny it
-Human relations are based on values like love, respect, loyalty, sacrifice, and trust
Hindu Ethics
-Four Sanskrit Vedas are believed to initiate Hinduism. The word Hindu is of ancient Persian origin
-Three main ethical concepts:
Dharma
duty to perform an action, carry out responsibilities without thinking about personal rewards. Work taken as sacred
Unpanishad
means to sacrifice for the organization/others
Karma
action will incur reaction
do good~ get rewards
do bad~ get punishment
Buddhist Ethics
Buddhism was founded by Siddhartha Gautama, also known as Buddha, which means the Enlightened
Ethics principles:
The Four Noble Truths:
concerns sufferings and the cessation of desire
The Noble Eightfold Path
concerns morality, meditation and wisdom
The Precept
refraining five things: causing injury; sexual immorality; falsehood; alcohol indulgence; stealing
The Four Noble Truths:
life is a suffering,
suffering is due to attachment
attachment can be overcome
there is a path for overcoming the attachment,
The Noble Eightfold Path:
Right View
Right Aspiration
Right Speech
Right Action
Right Livelihood
Right Effort
Right Mindfulness
Right Concentration.
Similar Values in Religions
-Support Good Ethics
-Be Responsible
-Uphold Justice
-Sustaining Human Relationships
RATIONALIST PHILOSOPHY
=Human thinking and reasoning are the bases for arriving at truth and in the same breath, right and wrong actions
=Rational theories:
Ethical Egoism - advocates individualistic decision-making
Utilitarian Principle - considers right and wrong actions based on the net benefits that the action brings to the society after taking into account the evaluation of all parties affected by the decision in terms of benefits and costs
Kantian Theory - we should carry out moral actions because it is our duty to do so and not because we want or are inclined to, or because the benefits outweigh the costs
CONTEMPORARY THOUGHTS
John Rawls - considered rights and obligations in his consequentialist theory of justice
Nozick - believed in the theory of entitlement, which partially says that everyone has the privilege to what they have acquired legally and justly
Ross - righteousness as important in fulfilling moral obligations or duties that are more urgent than others
Alisdair McIntyre - virtue or character is an acquired human quality that enables individuals to achieve happiness
TuneUp Utilities 2010
TuneUp Utilities 2010 can quickly make your Windows operating system faster, easier to use, and more secure. And all operations performed on the operating system are completely safe, because all changes are monitored by TuneUp Rescue Center and can be undone at any time. All TuneUp Utilities modules can be accessed through a common interface that is divided into six categories. In addition, the main window also has three general buttons in a dark gray bar to the right at the top of the window. Pressing the first button starts the TuneUp Rescue Center module. The second button starts the TuneUp Update Wizard, which can be used to update TuneUp Utilities 2009 to the latest version over the Internet. The last button provides help and settings that you can use to customize the software package to meet your needs.
The new Start page
TuneUp Utilities 2010 welcomes you with a completely redesigned Start page, which tells you about the status of your computer. If problems or nonoptimal settings are found, you are only a mouse-click away from resolving them. The Start page also tells you when new tips for increasing computer performance are available and warns you if maintenance tasks are not being taken care of automatically. The Start page also shows you whether new automatic startup programs have been added to Windows since the last time you ran TuneUp Utilities. You can decide whether these programs that start up automatically are really necessary.
TuneUp Speed Optimizer
Which settings slow your computer down? Which unnecessary services or programs are running in the background? Is your Internet connection optimally configured? TuneUp Speed Optimizer knows the answers to all these questions. It examines your entire system for bottlenecks, superfluous background programs, and incorrect settings. Great: with just one click you can carry out most optimizations very quickly. In addition, TuneUp Speed Optimizer provides suggestions for speeding up your system.
TuneUp Shortcut Cleaner
Cleaning up your working environment is tedious: removing invalid shortcuts from the Start menu, the Desktop, and the Quick Launch bar is very time-consuming. TuneUp ShortCut Cleaner now does the work for you. It checks whether all shortcuts are valid and removes the orphaned ones with just a click of a button. At the same time, empty folders are removed from the Start menu. TuneUp ShortCut Cleaner also checks frequently used programs and cleans up the list of recently opened files.
Support for the Opera browser
After hard disk defragmentation, which we introduced in TuneUp Utilities 2009, the feature most requested by customers was support for the Opera browser. TuneUp Utilities 2010 now also includes full support for Opera. Via several special Opera settings, TuneUp System Control now allows you to change the number of Speed Dial entries, conveniently choose your default search engine, and reenable fast backward and forward navigation. Internet optimization lets you optimize Opera's performance for your Internet connection. Free up disk space lets you delete the Opera cache.
TuneUp Styler
Now you can also change the Vista logo animation which appears just before logon. You can download a whole series of great animations from the TuneUp website. Or, if you prefer, you can choose your own personal image to display while Vista starts up. With Vista, you can also add your own images to Vista's logon screen: With just a few mouse clicks you can create a truly personal logon experience.
TuneUp Uninstall Manager
Redesigned from the ground up, TuneUp Install Manager now runs much faster and has a new, even more intuitive interface so that it is even easier to uninstall unnecessary programs. Unnecessary programs often are forgotten because they were installed a long time ago and then not used. TuneUp Utilities 2009 shows you a list of programs not used for a long time so that you can target for uninstallation those applications that use valuable disk space and in certain circumstances even slow your system down.
TuneUp StartUp Manager
A smooth-running system results when there are no unnecessary autostart applications. The improved TuneUp Startup Manager organizes your programs into groups and provides clear explanations to make it easier for you to identify those programs that are not needed.New automatic startup programs are now highlighted so that you can disable unwanted entries more easily. System start tasks are now also listed in TuneUp StartUp Manager In Vista, in particular, scheduled tasks are used in place of autostart entries.
Free up disk space
The already rapid display of disk space to be freed up is now even faster on NTFS drives. And now it is so easy to delete even more unnecessary files, like the backup files for the first Windows Vista service pack and the Opera and Safari caches. The second "Free up disk space" module that helps you turn off Windows functions that use excessive disk space has also been enhanced. The Windows Search index can now be disabled and deleted with a single click. This makes particular sense if you are already using a different search engine. In addition, TuneUp Disk Space Explorer now runs faster and no longer requires that an entire drive be analyzed. You can now specify that only those folders be analyzed that you are really interested in.
Lots more improvements
Along with the totally new features, there are a series of improvements that are not immediately visible. There are small improvements like Tooltips in the main window, a substantial increase in the number of problems that can be found byTuneUp Registry Cleaner, and better progress feedback from TuneUp Drive Defrag. But there are also big improvements "under the hood". Two good examples are a completely reworked installation program and significant improvements in our update technology.
The new Start page
TuneUp Utilities 2010 welcomes you with a completely redesigned Start page, which tells you about the status of your computer. If problems or nonoptimal settings are found, you are only a mouse-click away from resolving them. The Start page also tells you when new tips for increasing computer performance are available and warns you if maintenance tasks are not being taken care of automatically. The Start page also shows you whether new automatic startup programs have been added to Windows since the last time you ran TuneUp Utilities. You can decide whether these programs that start up automatically are really necessary.
TuneUp Speed Optimizer
Which settings slow your computer down? Which unnecessary services or programs are running in the background? Is your Internet connection optimally configured? TuneUp Speed Optimizer knows the answers to all these questions. It examines your entire system for bottlenecks, superfluous background programs, and incorrect settings. Great: with just one click you can carry out most optimizations very quickly. In addition, TuneUp Speed Optimizer provides suggestions for speeding up your system.
TuneUp Shortcut Cleaner
Cleaning up your working environment is tedious: removing invalid shortcuts from the Start menu, the Desktop, and the Quick Launch bar is very time-consuming. TuneUp ShortCut Cleaner now does the work for you. It checks whether all shortcuts are valid and removes the orphaned ones with just a click of a button. At the same time, empty folders are removed from the Start menu. TuneUp ShortCut Cleaner also checks frequently used programs and cleans up the list of recently opened files.
Support for the Opera browser
After hard disk defragmentation, which we introduced in TuneUp Utilities 2009, the feature most requested by customers was support for the Opera browser. TuneUp Utilities 2010 now also includes full support for Opera. Via several special Opera settings, TuneUp System Control now allows you to change the number of Speed Dial entries, conveniently choose your default search engine, and reenable fast backward and forward navigation. Internet optimization lets you optimize Opera's performance for your Internet connection. Free up disk space lets you delete the Opera cache.
TuneUp Styler
Now you can also change the Vista logo animation which appears just before logon. You can download a whole series of great animations from the TuneUp website. Or, if you prefer, you can choose your own personal image to display while Vista starts up. With Vista, you can also add your own images to Vista's logon screen: With just a few mouse clicks you can create a truly personal logon experience.
TuneUp Uninstall Manager
Redesigned from the ground up, TuneUp Install Manager now runs much faster and has a new, even more intuitive interface so that it is even easier to uninstall unnecessary programs. Unnecessary programs often are forgotten because they were installed a long time ago and then not used. TuneUp Utilities 2009 shows you a list of programs not used for a long time so that you can target for uninstallation those applications that use valuable disk space and in certain circumstances even slow your system down.
TuneUp StartUp Manager
A smooth-running system results when there are no unnecessary autostart applications. The improved TuneUp Startup Manager organizes your programs into groups and provides clear explanations to make it easier for you to identify those programs that are not needed.New automatic startup programs are now highlighted so that you can disable unwanted entries more easily. System start tasks are now also listed in TuneUp StartUp Manager In Vista, in particular, scheduled tasks are used in place of autostart entries.
Free up disk space
The already rapid display of disk space to be freed up is now even faster on NTFS drives. And now it is so easy to delete even more unnecessary files, like the backup files for the first Windows Vista service pack and the Opera and Safari caches. The second "Free up disk space" module that helps you turn off Windows functions that use excessive disk space has also been enhanced. The Windows Search index can now be disabled and deleted with a single click. This makes particular sense if you are already using a different search engine. In addition, TuneUp Disk Space Explorer now runs faster and no longer requires that an entire drive be analyzed. You can now specify that only those folders be analyzed that you are really interested in.
Lots more improvements
Along with the totally new features, there are a series of improvements that are not immediately visible. There are small improvements like Tooltips in the main window, a substantial increase in the number of problems that can be found byTuneUp Registry Cleaner, and better progress feedback from TuneUp Drive Defrag. But there are also big improvements "under the hood". Two good examples are a completely reworked installation program and significant improvements in our update technology.
TuneUp Utilities 2009
TuneUp Utilities 2009 can make your Windows operating system faster, more comfortable and more secure with just a few mouse clicks. And all operations performed on the operating system are completely safe, because all changes are monitored by TuneUp Rescue Center and can be undone at any time. All TuneUp Utilities modules can be accessed through a common interface that is divided into six categories.
The software helps both beginners and experts to make Windows meet their needs in a way that is better, easier and safer. All important system options are explained in an easy way and can be turned on or off at the click of your mouse. TuneUp Utilities 2009 will then make the necessary changes in the registry or boot files automatically. We place a high value on system stability, so that Windows won't stop working reliably. And most changes that you make can be undone in TuneUp Rescue Center - easily and safely.
The program also gives you many more options. In addition to helping you make Windows "better looking", you can also clean up and optimize your system at the click of a mouse. TuneUp Utilities 2009 will clean up unnecessary data from your hard disk and remove unnecessary entries from your registry. It can defragment your hard disk and registry and optimize your system settings to make Windows run substantially faster. Most of this maintenance is performed automatically every week by TuneUp 1-Click Maintenance.
Fast, Effective Windows Optimization
? One-click overview of your PC performance
? Quick analysis of your PC?s hardware, operating system, and programs
? Real performance increases, real fast
? Easy-to-understand help functions
Intelligent Windows Optimization Built in for Every PC
? Intelligent recommendations for your unique PC optimization
? Identifies your personal settings and protects them
? Highlights your PC?s optimization potential, including unused programs and resource-draining settings
? Recommends options and explains performance results before taking any action
Safe Windows Optimization
? Provides you with safe and effective optimization results
? Corrects all mistakes created from previous tuning attempts
? Comprehensive and easy rollback ability for any changes made to your PC
Perfectly Designed for Your Windows Operating System
? Automatically detects and configures for your operating system
? Ideal for XP and Vista (32/64 bit) users
? Designed to leverage the unique features within each operating system
Highlights of TuneUp Utilities 2009:
TuneUp Start page: Intuitive Layout, Easy to Use
* Provides quick and easy access to the most critical optimization functions
* A single yet comprehensive appraisal of your PC?s current performance and overall system health
TuneUp Speed Optimizer: Intelligent, Powerful Utility for any User Skill Level
* Easy optimization in just a few clicks
* Identifies unused programs and resource-draining functions
* Recommends tools for optimal PC performance
TuneUp 1-Click Maintenance: Automatic, Fast Optimization
* Enables one-click maintenance of the most important functions of your PC
* Cleans the Windows registry
* Deletes temporary files and folders
* Increases the system performance through integrated defragmentation
* Streamlines your desktop and simplifies folder shortcuts with one click
Improved Features of TuneUp Utilities 2009:
* TuneUp Drive Defrag: Intelligent defragmentation with new progress display
* TuneUp System Control: Supports Opera
* TuneUp Uninstall Manager: Intuitive uninstall options
* TuneUp Startup Manager: Increases the speed at the start-up of your PC
* TuneUp Styler: Expanded PC style options for Windows Vista (32/64 Bit)
* TuneUp Registry Cleaner: More powerful tool with in-depth view of your PC registry
The software helps both beginners and experts to make Windows meet their needs in a way that is better, easier and safer. All important system options are explained in an easy way and can be turned on or off at the click of your mouse. TuneUp Utilities 2009 will then make the necessary changes in the registry or boot files automatically. We place a high value on system stability, so that Windows won't stop working reliably. And most changes that you make can be undone in TuneUp Rescue Center - easily and safely.
The program also gives you many more options. In addition to helping you make Windows "better looking", you can also clean up and optimize your system at the click of a mouse. TuneUp Utilities 2009 will clean up unnecessary data from your hard disk and remove unnecessary entries from your registry. It can defragment your hard disk and registry and optimize your system settings to make Windows run substantially faster. Most of this maintenance is performed automatically every week by TuneUp 1-Click Maintenance.
Fast, Effective Windows Optimization
? One-click overview of your PC performance
? Quick analysis of your PC?s hardware, operating system, and programs
? Real performance increases, real fast
? Easy-to-understand help functions
Intelligent Windows Optimization Built in for Every PC
? Intelligent recommendations for your unique PC optimization
? Identifies your personal settings and protects them
? Highlights your PC?s optimization potential, including unused programs and resource-draining settings
? Recommends options and explains performance results before taking any action
Safe Windows Optimization
? Provides you with safe and effective optimization results
? Corrects all mistakes created from previous tuning attempts
? Comprehensive and easy rollback ability for any changes made to your PC
Perfectly Designed for Your Windows Operating System
? Automatically detects and configures for your operating system
? Ideal for XP and Vista (32/64 bit) users
? Designed to leverage the unique features within each operating system
Highlights of TuneUp Utilities 2009:
TuneUp Start page: Intuitive Layout, Easy to Use
* Provides quick and easy access to the most critical optimization functions
* A single yet comprehensive appraisal of your PC?s current performance and overall system health
TuneUp Speed Optimizer: Intelligent, Powerful Utility for any User Skill Level
* Easy optimization in just a few clicks
* Identifies unused programs and resource-draining functions
* Recommends tools for optimal PC performance
TuneUp 1-Click Maintenance: Automatic, Fast Optimization
* Enables one-click maintenance of the most important functions of your PC
* Cleans the Windows registry
* Deletes temporary files and folders
* Increases the system performance through integrated defragmentation
* Streamlines your desktop and simplifies folder shortcuts with one click
Improved Features of TuneUp Utilities 2009:
* TuneUp Drive Defrag: Intelligent defragmentation with new progress display
* TuneUp System Control: Supports Opera
* TuneUp Uninstall Manager: Intuitive uninstall options
* TuneUp Startup Manager: Increases the speed at the start-up of your PC
* TuneUp Styler: Expanded PC style options for Windows Vista (32/64 Bit)
* TuneUp Registry Cleaner: More powerful tool with in-depth view of your PC registry
Kaspersky Anti-Virus 2010
The Kaspersky Anti-Virus 2009 application was designed to be the backbone of your PC's security system, offering protection from a range of IT threats.
Kaspersky Anti-Virus 2009 provides the basic tools needed to protect your PC.
Here are some key features of "Kaspersky Antivirus Personal":
Essential Protection
� Protects from viruses, Trojans and worms
� Blocks spyware and adware
� Scans files in real time (on access) and on demand
� Scans email messages (regardless of email client)
� Scans Internet traffic (regardless of browser)
� Protects instant messengers (ICQ, MSN)
� Provides proactive protection from unknown threats
� Scans Java and Visual Basic scripts
Preventive Protection
� Scans operating system and installed applications for vulnerabilities
� Analyzes and closes Internet Explorer vulnerabilities
� Disables links to malware sites
� Detects viruses based on the packers used to compress code
� Global threat monitoring (Kaspersky Security Network)
Advanced Protection & Recovery
� The program can be installed on infected computers
� Self-protection from being disabled or stopped
� Restores correct system settings after removing malicious software
� Tools for creating a rescue disk
� Data & Identity Theft Protection
� Disables links to fake (phishing) websites
� Blocks all types of keyloggers
Usability
� Automatic configuration during installation
� Wizards for common tasks
� Visual reports with charts and diagrams
� Alerts provide all the information necessary for informed user decisions
� Automatic or interactive mode
� Round-the-clock technical support
� Automatic database updates
Requirements:
� Intel Pentium 800 MHz 32 bit (x86) / 64 bit (x64) or higher (or equivalent)
� 512 MB available RAM
� 50 MB free space on the hard drive
� CD-ROM (for installation of the program from CD)
� computer mouse
� Internet connection (for product activation)
� Microsoft Internet Explorer 5.5 or higher (for downloading updates)
� Microsoft Windows Installer 2.0
What's New in This Release:
� FIXES
� Problem with system instability after long period of program operation has been fixed.
� Error causing BSOD while updating the emulator driver has been fixed.
� Pop-up message in the URL checking module has been fixed (for the Spanish version).
� Problem with pausing the scan task while third party programs are running in full-screen mode has been fixed.
� Problem with the update task freezing at system startup has been fixed.
� Vulnerability that allowed disabling of computer protection using an external script has been eliminated.
� Driver crash in rare cases while processing a write operation has been fixed.
� Crash while processing data incompliant with the protocol of Mail.Ru Agent has been fixed.
� MAIN KNOWN ISSUES
� If a threat in OLE object is detected, the application does not suggest user to perform disinfection. Possible actions in this case � place file to quarantine or delete it.
� Web Anti-Virus does not notify user about the downloaded files.
Kaspersky Anti-Virus 2009 provides the basic tools needed to protect your PC.
Here are some key features of "Kaspersky Antivirus Personal":
Essential Protection
� Protects from viruses, Trojans and worms
� Blocks spyware and adware
� Scans files in real time (on access) and on demand
� Scans email messages (regardless of email client)
� Scans Internet traffic (regardless of browser)
� Protects instant messengers (ICQ, MSN)
� Provides proactive protection from unknown threats
� Scans Java and Visual Basic scripts
Preventive Protection
� Scans operating system and installed applications for vulnerabilities
� Analyzes and closes Internet Explorer vulnerabilities
� Disables links to malware sites
� Detects viruses based on the packers used to compress code
� Global threat monitoring (Kaspersky Security Network)
Advanced Protection & Recovery
� The program can be installed on infected computers
� Self-protection from being disabled or stopped
� Restores correct system settings after removing malicious software
� Tools for creating a rescue disk
� Data & Identity Theft Protection
� Disables links to fake (phishing) websites
� Blocks all types of keyloggers
Usability
� Automatic configuration during installation
� Wizards for common tasks
� Visual reports with charts and diagrams
� Alerts provide all the information necessary for informed user decisions
� Automatic or interactive mode
� Round-the-clock technical support
� Automatic database updates
Requirements:
� Intel Pentium 800 MHz 32 bit (x86) / 64 bit (x64) or higher (or equivalent)
� 512 MB available RAM
� 50 MB free space on the hard drive
� CD-ROM (for installation of the program from CD)
� computer mouse
� Internet connection (for product activation)
� Microsoft Internet Explorer 5.5 or higher (for downloading updates)
� Microsoft Windows Installer 2.0
What's New in This Release:
� FIXES
� Problem with system instability after long period of program operation has been fixed.
� Error causing BSOD while updating the emulator driver has been fixed.
� Pop-up message in the URL checking module has been fixed (for the Spanish version).
� Problem with pausing the scan task while third party programs are running in full-screen mode has been fixed.
� Problem with the update task freezing at system startup has been fixed.
� Vulnerability that allowed disabling of computer protection using an external script has been eliminated.
� Driver crash in rare cases while processing a write operation has been fixed.
� Crash while processing data incompliant with the protocol of Mail.Ru Agent has been fixed.
� MAIN KNOWN ISSUES
� If a threat in OLE object is detected, the application does not suggest user to perform disinfection. Possible actions in this case � place file to quarantine or delete it.
� Web Anti-Virus does not notify user about the downloaded files.
Kaspersky Internet Security 2010
Kaspersky Internet Security 2010 is the backbone of your PC's security system, offering protection from a range of IT threats. Kaspersky Anti-Virus 2010 provides the basic tools needed to protect your PC.
Kaspersky Internet Security 2010 is the all-in-one security solution that offers a worry-free computing environment for you and your family. Kaspersky Internet Security 2010 has everything you need for a safe and secure Internet experience. Kaspersky Internet Security 9.0 that is a new line of Kaspersky Labs products, which is designed for the multi-tiered protection of personal computers. This product is based on in-house protection components, which are based on variety of technologies for maximum levels of user protection regardless of technical competencies. This product utilizes several technologies, which were jointly developed by Kaspersky Labs and other companies; part of them is implemented via online-services.
Our products for home and home office are specifically designed to provide hassle-free and quality protection against viruses, worms and other malicious programs, as well as hacker attacks, spam and spyware.
During product preparation several competitor offerings were considered and analyzed - firewalls, security suites systems, which position themselves as proactive in defence and HIPS systems. Combination of in-hosue innovative developments and results from analysis gathered through the industry allowed to jump onto a new level of protection for personal users, whereby offering even more hardened and less annoying computer protection from all types of electronic threats and malicious programs of different types, hacker attacks, spam mailings, program-root kits, phishing emails, advertisement popup windows etc.
Kaspersky Internet Security 2010 All Features:
Essential Protection:
* Protects from viruses, Trojans and worms
* Blocks spyware and adware
* Scans files in real time (on access) and on demand
* Scans email messages (regardless of email client)
* Scans Internet traffic (regardless of browser)
* Protects instant messengers (ICQ, MSN)
* Provides proactive protection from unknown threats
* Scans Java and Visual Basic scripts
Extended Protection:
* Two-way personal firewall
* Safe Wi-Fi and VPN connections
* Intrusion prevention system
* Intelligent application management and control
o automatically configured application rules
o security rating is assigned to unknown applications
o access to the user̢۪s resources and data is restricted for unknown applications
Preventive Protection:
* Scans operating system and installed applications for vulnerabilities
* Analyzes and closes Internet Explorer vulnerabilities
* Disables links to malware sites
* Detects viruses based on the packers used to compress code
* Global threat monitoring (Kaspersky Security Network)
Advanced Protection & Recovery:
* The program can be installed on infected computers
* Self-protection from being disabled or stopped
* Restores correct system settings after removing malicious software
* Tools for creating a rescue disk
Data & Identity Theft Protection:
* Disables links to fake (phishing) websites
* Blocks all types of keyloggers
* Virtual keyboard is provided for safely entering logins and passwords
* Prevents the theft of data exchanged via secure connections (HTTPS / SSL)
* Blocks unauthorized dial-up connections
* Cleans up any traces of user activity (deletes temporary files, cookies etc.)
Content Filtering:
* Parental control
* Improved antispam protection (plugins for Microsoft Outlook, Microsoft Outlook Express, The Bat!, Thunderbird)
* Blocks banners on web pages
Usability:
* Automatic configuration during installation
* Wizards for common tasks
* Visual reports with charts and diagrams
* Alerts provide all the information necessary for informed user decisions
* Automatic or interactive mode
* Round-the-clock technical support
* Automatic database updates
OS: Windows 2000/XP/Vista/Seven
http://www.kaspersky.com
Kaspersky Internet Security 2010 is the all-in-one security solution that offers a worry-free computing environment for you and your family. Kaspersky Internet Security 2010 has everything you need for a safe and secure Internet experience. Kaspersky Internet Security 9.0 that is a new line of Kaspersky Labs products, which is designed for the multi-tiered protection of personal computers. This product is based on in-house protection components, which are based on variety of technologies for maximum levels of user protection regardless of technical competencies. This product utilizes several technologies, which were jointly developed by Kaspersky Labs and other companies; part of them is implemented via online-services.
Our products for home and home office are specifically designed to provide hassle-free and quality protection against viruses, worms and other malicious programs, as well as hacker attacks, spam and spyware.
During product preparation several competitor offerings were considered and analyzed - firewalls, security suites systems, which position themselves as proactive in defence and HIPS systems. Combination of in-hosue innovative developments and results from analysis gathered through the industry allowed to jump onto a new level of protection for personal users, whereby offering even more hardened and less annoying computer protection from all types of electronic threats and malicious programs of different types, hacker attacks, spam mailings, program-root kits, phishing emails, advertisement popup windows etc.
Kaspersky Internet Security 2010 All Features:
Essential Protection:
* Protects from viruses, Trojans and worms
* Blocks spyware and adware
* Scans files in real time (on access) and on demand
* Scans email messages (regardless of email client)
* Scans Internet traffic (regardless of browser)
* Protects instant messengers (ICQ, MSN)
* Provides proactive protection from unknown threats
* Scans Java and Visual Basic scripts
Extended Protection:
* Two-way personal firewall
* Safe Wi-Fi and VPN connections
* Intrusion prevention system
* Intelligent application management and control
o automatically configured application rules
o security rating is assigned to unknown applications
o access to the user̢۪s resources and data is restricted for unknown applications
Preventive Protection:
* Scans operating system and installed applications for vulnerabilities
* Analyzes and closes Internet Explorer vulnerabilities
* Disables links to malware sites
* Detects viruses based on the packers used to compress code
* Global threat monitoring (Kaspersky Security Network)
Advanced Protection & Recovery:
* The program can be installed on infected computers
* Self-protection from being disabled or stopped
* Restores correct system settings after removing malicious software
* Tools for creating a rescue disk
Data & Identity Theft Protection:
* Disables links to fake (phishing) websites
* Blocks all types of keyloggers
* Virtual keyboard is provided for safely entering logins and passwords
* Prevents the theft of data exchanged via secure connections (HTTPS / SSL)
* Blocks unauthorized dial-up connections
* Cleans up any traces of user activity (deletes temporary files, cookies etc.)
Content Filtering:
* Parental control
* Improved antispam protection (plugins for Microsoft Outlook, Microsoft Outlook Express, The Bat!, Thunderbird)
* Blocks banners on web pages
Usability:
* Automatic configuration during installation
* Wizards for common tasks
* Visual reports with charts and diagrams
* Alerts provide all the information necessary for informed user decisions
* Automatic or interactive mode
* Round-the-clock technical support
* Automatic database updates
OS: Windows 2000/XP/Vista/Seven
http://www.kaspersky.com
week 2 : asp.net
Caching ASP.NET applications
----------------------------
Caching asp.net applications improve the performance.
Dim strprod As String
Dim strSelect As String
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
strprod= Request.Param("PID")
if strprod = Nothing then
strprod=1
End if
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\Nwind.mdb"))
strSelect = "select * from Products where productdID= "
& strprod
cmd = New OleDbCommand(strSelect, con)
con.Open()
dr = cmd.ExecuteReader()
GridView1.DataSource = dr
GridView1.DataBind()
dr.Close()
con.Close()
-----------------------------------------------------------
Use the same procedure for the authors table of pubs database
with state as Varying parameter
--------------------------------------------------------
Protected Sub btn_WriteCookies_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_WriteCookies.Click
Response.Cookies("userName").Value = txtcookie_name.Text
Response.Cookies("userName").Expires =
DateTime.Now.AddDays(1)
End Sub
-------------------------------------------------------------
If Not Request.Cookies("userName") Is Nothing Then
txtcookie_name.Text =
server.HtmlEncode(Request.Cookies("userName").Value)
txtcookie_expired.Text =
Server.HtmlEncode(Request.Cookies("userName").Expires)
End If
--------------------------------------
Protected Sub btn_deleteCookies_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_deleteCookies.Click
If Not Request.Cookies("userName") Is Nothing Then
Response.Cookies("userName").Expires =
DateTime.Now.AddDays(-1D)
End If
End Sub
----------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand(txtquery.Text.ToString, con)
GridView1.DataSource = cmd.ExecuteReader()
GridView1.DataBind()
con.Close()
INNER JOIN:
LIST RECORDS ONLY IF THERE IS A MATCHING ON BOTH SIDES.
[ WHERE CLASS ]
LEFT JOIN
LIST ALL RECORDS FROM THE LEFT TABLE , EVEN
THERE IS NO MATCHING ON RIGHT TABLE
[ ON CLASS ]
RIGHT JOIN
LIST ALL RECORDS FROM THE RIGTH TABLE , EVEN
THERE IS NO MATCHING ON LEFT TABLE
[ ON CLASS ]
SELF JOIN
A TABLE JOINS TO ITSELF IS KNOWN AS
SELF JOIN
SELECT e.EMPID , e.EMPNAME "EMPLOYEE NAME" ,
m.EMPNAME "MANAGERS NAME"
FROM EMP e , EMP m
WHERE e.MGRID = m.EMPID
------------------------------------------------------------
web configuration file
------------------------
each web page has web configuration file.
Parameters can be intialized or modified in the
web configuration file.
web configuration file is an xml file.
----------------------------------------------------------
---------------------------------------------------------
Imports System.Configuration
---------------------------------------------------------
Dim str As String = ""
Dim con As SqlConnection
Dim cmd As SqlCommand
str = ConfigurationSettings.AppSettings("constring")
con = New SqlConnection(str)
cmd = New SqlCommand("select * from emp", con)
con.Open()
GridView1.DataSource = cmd.ExecuteReader
GridView1.DataBind()
con.Close()
------------------------------------------------------------
change the web config file for the
ms-access database. display authors table
in the grid view format.
----------------------------------------------------------
-------------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim str As String
str = ConfigurationSettings.AppSettings("constring")
con = New OleDbConnection(str)
cmd = New OleDbCommand("select * from authors", con)
con.Open()
GridView1.DataSource = cmd.ExecuteReader
GridView1.DataBind()
con.Close()
--------------------------------------------------------------
-------------------------------------------------------------
imports system.data.oledb
imports system.data.sqlclient
imports system.configuration
-------------------------------------------------------------
Dim conaccess As OleDbConnection
Dim consqlserver As sqlconnection
Dim cmdaccess As OleDbCommand
Dim cmdsqlcommand As SqlCommand
Dim str1, str2 As String
str1 = ConfigurationSettings.AppSettings("conaccessstr")
str2 = ConfigurationSettings.AppSettings("consqlserverstr")
conaccess = New OleDbConnection(str1)
consqlserver = New SqlConnection(str2)
cmdaccess=New OleDbCommand("select * from authors", conaccess)
cmdsqlcommand=New SqlCommand("Select * from emp", consqlserver)
conaccess.Open()
consqlserver.Open()
GridView1.DataSource = cmdaccess.ExecuteReader
GridView1.DataBind()
GridView2.DataSource = cmdsqlcommand.ExecuteReader
GridView2.DataBind()
conaccess.Close()
consqlserver.Close()
---------------------- End of Connection String---------------
------------------------Break Time ---------------------------
Error Handling or Exceptional Handlings
---------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
con = New SqlConnection("server=localhost ;uid=sa;
pwd=dbexpert;database=dbx; Connection Timeout=15")
cmd = New sqlcommand("Select * from products" , con)
try
con.open()
gridview1.datasource = cmd.executeReader()
gridview1.databind()
con.close()
Catch
Response.write("we are sorry , Server is down ")
End try
----------------------End of Today-----------------------
_
Public Function CTOF(ByVal C As Double)
As double
Return (C * 1.8 + 32)
End Function
------------------------------------------------
_
Public Function FTOC(ByVal F As Double)
As double
Return (F - 32) / 1.8
End Function
---------------------------------------------------
_
Public Function TotalMarks(ByVal x As Integer,
ByVal y As Integer,
ByVal z As Integer) As Integer
Return (x + y + z)
End Function
------------------------------------------------------------
write webmethod area_circle
to find the area of circle for a given radius (r)
r is double , return value is also double
---------------------------------------------------------
use dbx
go
create table userlist
( u_id int not null identity ,
u_username varchar(25) ,
u_password varchar(25) )
----------------------------------------------------
identity is a constraint , incremented by 1
everytime , whenever we insert a record
-----------------------------------------------------
insert into userlist (u_username,u_password)
values('dbexpert' , 'abc123')
------------------------------------------------------
insert into userlist (u_username,u_password)
values('sam' , 'secret')
------------------------------------------------------
delete from userlist
--------------------------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
LBLmessage.Text = ""
Dim found As Integer = 0
con = New SqlConnection("server=localhost;uid=sa;pwd=dbexpert;database=dbx")
cmd = New SqlCommand("select count(*) from userlist where u_username=@name
and u_password =@pwd", con)
con.Open()
cmd.Parameters.AddWithValue("@name", txtUserName.Text)
cmd.Parameters.AddWithValue("@pwd", txtPassword.Text)
found = cmd.ExecuteScalar()
If found > 0 Then
Response.Redirect("welcome.aspx")
Else
LBLmessage.Text = "Invalid username / password"
End If
con.Close()
-----------------------------------------------------------------------
Dim con As SqlConnection
Dim cmdfound As SqlCommand
Dim cmdinsert As sqlcommand
Dim found As Integer = 0
Dim rec As Integer =0
LBLmessage.Text = ""
con = New SqlConnection("server=localhost;uid=sa;pwd=dbexpert;database=dbx")
cmdfound = new sqlcommand("select count(*) from userlist
where u_username = @name" ,con)
con.open()
cmdfound.parameters.addwithvalue("@name" , txtnewusername.text)
found = cmdfound.executescalar()
if found > 0 then
lblmessage.text ="Use Name alreay in the database ,try different name"
else
cmd = New SqlCommand("insert into userlist (u_username,u_password)
values( @name ,@pwd)", con)
cmd.Parameters.AddWithValue("@name", txtnewUserName.Text)
cmd.Parameters.AddWithValue("@pwd", txtnewPassword.Text)
rec = cmd.executeNonQuery()
if rec > 0 then
LBLmessage.Text = "Ur Name is registered "
Response.redirect("default.aspx")
End If
con.Close()
-----------------------------------------------------------------------------
Dim con As SqlConnection
Dim cmdfound As SqlCommand
Dim cmdinsert As SqlCommand
Dim found As Integer = 0
Dim rec As Integer = 0
LBLmessage.Text = ""
con = New SqlConnection("server=localhost;uid=sa;pwd=dbexpert;database=dbx")
cmdfound = New SqlCommand("select count(*) from userlist
where u_username = @name", con)
con.Open()
cmdfound.Parameters.AddWithValue("@name", txtnewusername.Text)
found = cmdfound.ExecuteScalar()
If found > 0 Then
LBLmessage.Text = "Use Name alreay in the database ,try different name"
Else
cmdinsert = New SqlCommand("insert into userlist (u_username,u_password) values( @name ,@pwd)", con)
cmdinsert.Parameters.AddWithValue("@name", txtnewusername.Text)
cmdinsert.Parameters.AddWithValue("@pwd", txtnewpassword.Text)
rec = cmdinsert.ExecuteNonQuery()
If rec > 0 Then
LBLmessage.Text = "Ur Name is registered "
Response.Redirect("default.aspx")
End If
End If
con.Close()
----------------------------
Caching asp.net applications improve the performance.
Dim strprod As String
Dim strSelect As String
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
strprod= Request.Param("PID")
if strprod = Nothing then
strprod=1
End if
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\Nwind.mdb"))
strSelect = "select * from Products where productdID= "
& strprod
cmd = New OleDbCommand(strSelect, con)
con.Open()
dr = cmd.ExecuteReader()
GridView1.DataSource = dr
GridView1.DataBind()
dr.Close()
con.Close()
-----------------------------------------------------------
Use the same procedure for the authors table of pubs database
with state as Varying parameter
--------------------------------------------------------
Protected Sub btn_WriteCookies_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_WriteCookies.Click
Response.Cookies("userName").Value = txtcookie_name.Text
Response.Cookies("userName").Expires =
DateTime.Now.AddDays(1)
End Sub
-------------------------------------------------------------
If Not Request.Cookies("userName") Is Nothing Then
txtcookie_name.Text =
server.HtmlEncode(Request.Cookies("userName").Value)
txtcookie_expired.Text =
Server.HtmlEncode(Request.Cookies("userName").Expires)
End If
--------------------------------------
Protected Sub btn_deleteCookies_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_deleteCookies.Click
If Not Request.Cookies("userName") Is Nothing Then
Response.Cookies("userName").Expires =
DateTime.Now.AddDays(-1D)
End If
End Sub
----------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand(txtquery.Text.ToString, con)
GridView1.DataSource = cmd.ExecuteReader()
GridView1.DataBind()
con.Close()
INNER JOIN:
LIST RECORDS ONLY IF THERE IS A MATCHING ON BOTH SIDES.
[ WHERE CLASS ]
LEFT JOIN
LIST ALL RECORDS FROM THE LEFT TABLE , EVEN
THERE IS NO MATCHING ON RIGHT TABLE
[ ON CLASS ]
RIGHT JOIN
LIST ALL RECORDS FROM THE RIGTH TABLE , EVEN
THERE IS NO MATCHING ON LEFT TABLE
[ ON CLASS ]
SELF JOIN
A TABLE JOINS TO ITSELF IS KNOWN AS
SELF JOIN
SELECT e.EMPID , e.EMPNAME "EMPLOYEE NAME" ,
m.EMPNAME "MANAGERS NAME"
FROM EMP e , EMP m
WHERE e.MGRID = m.EMPID
------------------------------------------------------------
web configuration file
------------------------
each web page has web configuration file.
Parameters can be intialized or modified in the
web configuration file.
web configuration file is an xml file.
----------------------------------------------------------
---------------------------------------------------------
Imports System.Configuration
---------------------------------------------------------
Dim str As String = ""
Dim con As SqlConnection
Dim cmd As SqlCommand
str = ConfigurationSettings.AppSettings("constring")
con = New SqlConnection(str)
cmd = New SqlCommand("select * from emp", con)
con.Open()
GridView1.DataSource = cmd.ExecuteReader
GridView1.DataBind()
con.Close()
------------------------------------------------------------
change the web config file for the
ms-access database. display authors table
in the grid view format.
----------------------------------------------------------
-------------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim str As String
str = ConfigurationSettings.AppSettings("constring")
con = New OleDbConnection(str)
cmd = New OleDbCommand("select * from authors", con)
con.Open()
GridView1.DataSource = cmd.ExecuteReader
GridView1.DataBind()
con.Close()
--------------------------------------------------------------
-------------------------------------------------------------
imports system.data.oledb
imports system.data.sqlclient
imports system.configuration
-------------------------------------------------------------
Dim conaccess As OleDbConnection
Dim consqlserver As sqlconnection
Dim cmdaccess As OleDbCommand
Dim cmdsqlcommand As SqlCommand
Dim str1, str2 As String
str1 = ConfigurationSettings.AppSettings("conaccessstr")
str2 = ConfigurationSettings.AppSettings("consqlserverstr")
conaccess = New OleDbConnection(str1)
consqlserver = New SqlConnection(str2)
cmdaccess=New OleDbCommand("select * from authors", conaccess)
cmdsqlcommand=New SqlCommand("Select * from emp", consqlserver)
conaccess.Open()
consqlserver.Open()
GridView1.DataSource = cmdaccess.ExecuteReader
GridView1.DataBind()
GridView2.DataSource = cmdsqlcommand.ExecuteReader
GridView2.DataBind()
conaccess.Close()
consqlserver.Close()
---------------------- End of Connection String---------------
------------------------Break Time ---------------------------
Error Handling or Exceptional Handlings
---------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
con = New SqlConnection("server=localhost ;uid=sa;
pwd=dbexpert;database=dbx; Connection Timeout=15")
cmd = New sqlcommand("Select * from products" , con)
try
con.open()
gridview1.datasource = cmd.executeReader()
gridview1.databind()
con.close()
Catch
Response.write("we are sorry , Server is down ")
End try
----------------------End of Today-----------------------
Public Function CTOF(ByVal C As Double)
As double
Return (C * 1.8 + 32)
End Function
------------------------------------------------
Public Function FTOC(ByVal F As Double)
As double
Return (F - 32) / 1.8
End Function
---------------------------------------------------
Public Function TotalMarks(ByVal x As Integer,
ByVal y As Integer,
ByVal z As Integer) As Integer
Return (x + y + z)
End Function
------------------------------------------------------------
write webmethod area_circle
to find the area of circle for a given radius (r)
r is double , return value is also double
---------------------------------------------------------
use dbx
go
create table userlist
( u_id int not null identity ,
u_username varchar(25) ,
u_password varchar(25) )
----------------------------------------------------
identity is a constraint , incremented by 1
everytime , whenever we insert a record
-----------------------------------------------------
insert into userlist (u_username,u_password)
values('dbexpert' , 'abc123')
------------------------------------------------------
insert into userlist (u_username,u_password)
values('sam' , 'secret')
------------------------------------------------------
delete from userlist
--------------------------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
LBLmessage.Text = ""
Dim found As Integer = 0
con = New SqlConnection("server=localhost;uid=sa;pwd=dbexpert;database=dbx")
cmd = New SqlCommand("select count(*) from userlist where u_username=@name
and u_password =@pwd", con)
con.Open()
cmd.Parameters.AddWithValue("@name", txtUserName.Text)
cmd.Parameters.AddWithValue("@pwd", txtPassword.Text)
found = cmd.ExecuteScalar()
If found > 0 Then
Response.Redirect("welcome.aspx")
Else
LBLmessage.Text = "Invalid username / password"
End If
con.Close()
-----------------------------------------------------------------------
Dim con As SqlConnection
Dim cmdfound As SqlCommand
Dim cmdinsert As sqlcommand
Dim found As Integer = 0
Dim rec As Integer =0
LBLmessage.Text = ""
con = New SqlConnection("server=localhost;uid=sa;pwd=dbexpert;database=dbx")
cmdfound = new sqlcommand("select count(*) from userlist
where u_username = @name" ,con)
con.open()
cmdfound.parameters.addwithvalue("@name" , txtnewusername.text)
found = cmdfound.executescalar()
if found > 0 then
lblmessage.text ="Use Name alreay in the database ,try different name"
else
cmd = New SqlCommand("insert into userlist (u_username,u_password)
values( @name ,@pwd)", con)
cmd.Parameters.AddWithValue("@name", txtnewUserName.Text)
cmd.Parameters.AddWithValue("@pwd", txtnewPassword.Text)
rec = cmd.executeNonQuery()
if rec > 0 then
LBLmessage.Text = "Ur Name is registered "
Response.redirect("default.aspx")
End If
con.Close()
-----------------------------------------------------------------------------
Dim con As SqlConnection
Dim cmdfound As SqlCommand
Dim cmdinsert As SqlCommand
Dim found As Integer = 0
Dim rec As Integer = 0
LBLmessage.Text = ""
con = New SqlConnection("server=localhost;uid=sa;pwd=dbexpert;database=dbx")
cmdfound = New SqlCommand("select count(*) from userlist
where u_username = @name", con)
con.Open()
cmdfound.Parameters.AddWithValue("@name", txtnewusername.Text)
found = cmdfound.ExecuteScalar()
If found > 0 Then
LBLmessage.Text = "Use Name alreay in the database ,try different name"
Else
cmdinsert = New SqlCommand("insert into userlist (u_username,u_password) values( @name ,@pwd)", con)
cmdinsert.Parameters.AddWithValue("@name", txtnewusername.Text)
cmdinsert.Parameters.AddWithValue("@pwd", txtnewpassword.Text)
rec = cmdinsert.ExecuteNonQuery()
If rec > 0 Then
LBLmessage.Text = "Ur Name is registered "
Response.Redirect("default.aspx")
End If
End If
con.Close()
week 1 : asp.net
1. Label [ Radius of circle ]
2. Text box[ txtrad ] - to enter value for radius
3. Button -[ Area & circum ] BTN_ARE_CIR
-----------------------------------------------
txtarea.Text = 3.14 * txtrad.Text * txtrad.Text
txtcir.Text = 2 * 3.14 * txtrad.Text
------------------------------------------------
whenever if we change the value of text ,
textchanged event is executed on its own.
--------------------------------------------------
Performing form validation with Validation Controls
---------------------------------------------------
By providing validation controls , we can
reduce the error made by the user. Errors are
reduced considerably , but not guaranteed that
we can elimiate 100 % errors.
Keeping more controls reduced the error levels
but at the same time , speed will be reduced.
1. server side validation[vb.net
2. client side validation[vbscript, javascript]
Server side validation
Demerits : network traffic , can not get thru,
Most of the time server busy in validation
Merits : More secured. No one can bypass the
validation
Client side:
------------
Demerits: Not secured. Smart programmers can by pass
the validation
merits : less network traffic
server side validation controls
-------------------------------
REQUIRED FIELD VALIDATOR
REGULAR EXPRESSION VALIDATOR
COMPARE VALIDATOR
RANGE VALIDATOR
VALIDATIONSUMMARY CONTROL VALIDATOR
CUSTOM VALIDATOR
REQUIRED FIELD VALIDATOR
------------------------
Used to check whether field is empty or not
Properties :
ControlToValidate
Text
Isvalid : Has the valid true when the validation
check succeeds and false otherwise
Compare Validator
-----------------
Performs comparisons between the data entered
into a form field and another value.
The other value can be fixed value , such
as particular number or value entered into another
control.
Properties :
ControlToValidate ,ControlToCompare,
IsValid , Operator , type , text
value to compare.
VALIDATIONS
1. Amount field shoul not be empty.
2. Entererd value must be more than 2300.
Include Neccessary validation controls to
achieve the two goas 1 and 2
hint: use Required field validator for
the validation 1.
Use compare validator for validation 2
ControlToValidate = txtamt
ValueToCompare = 2300
type = Money
Operator = Greater than
text = Must be greater than 2300
--------------------------------------------------------
REGULAR EXPRESSION - CONTROL
----------------------------
This is used to validate like phone number ,
email address, postal code , code number etc.
Property : controlToValidate , text
, ValidationExpression.
symbols used
-------------
[ ] - Range
[0-4] -Can be any numbers form 0 to 4.
{ } - Exact length
{2} - Exact length 2
+ - one or more characters
* - zero or more characters
--------------------------------------------------------
P[0-9]{4}- P followed by 4 digits lenth
[pP][0-9]{4} - Either lower case p or Upper case P
followed by 4 digits lenth
[^0][0-9]{4}
[^0] = not zero included
[^0^a-z^A-Z][0-9]{4}
----------------------------------------------------
RangeValidator:
Property : controlTovalidate , type , text ,
MinimumValue , MaximumValue
------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
con = New OleDbconnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.open()
cmd = New oledbcommand("Select au_lname ,STATE
from authors WHERE STATE='CA' " ,con)
dr = cmd.ExecuteReader()
while dr.read()
Response.write("")
Response.write(dr("au_lname")+ " ")
Response.write(dr("STATE"))
End While
dr.close()
con.close()
---------------------------------------------------
List au_lname , STATE from authors table who stay
in state "CA"
SELECT AU_LNAME , STATE FROM AUTHORS WHERE STATE="CA"
--------------------------------------------------------
ExecuteScalar is used to if it fetches only one record,
Example: count , min , max , total
avg .. etc
select count(*) from authors - Returns total records
in the table.
select min(salary) from authors - Returns minimum salary
in the table.
------------------------------------------------------
question 3 : Display the number of records from
the authors table of pubs database.
Output
There are 23 records in the authors table
-------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("select count(*) from authors", con)
LBLCOUNT.Text = cmd.ExecuteScalar()
con.Close()
--------------------------------------------------------
Display au_lname , state those who stay
in any one of the states (CA ,KS,IN)
-------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("select * from titles ", con)
GV1.DataSource = cmd.ExecuteReader()
GV1.DataBind()
con.Close()
----------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = new oledbcommand("select phone from authors
where au_fname=@fname and au_lname =@lname" ,con)
cmd.parameters.add("@fname" , txtfname.text)
cmd.parameters.add("@lname" , txtlname.text)
txtphone.text = cmd.executescalar()
con.close()
-----------------------------------------------------------
fname = ann
lastname = dull
----------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("select * from titles where type =@type", con)
cmd.Parameters.Add("@type", txttype.Text)
GV1.DataSource = cmd.ExecuteReader()
GV1.DataBind()
con.Close()
--------------------------------------------------
update statement
----------------
we want to update phone field of authors table with
new phone number for a given first name and last name
update table_name set field = value
where condition
UPDATE authors set phone = @newPhone
where au_fname=@fname and au_lname=@lname
----------------------------------------------
executeNonQuery is a method used to insert , update
and for delete statements
cmd.executeNonquery()
----------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim cnt As Integer = 0
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("update authors set phone=@phone
where au_fname=@fname and au_lname=@lname", con)
cmd.Parameters.AddWithValue("@phone", txtphone.Text)
cmd.Parameters.AddWithValue("@fname", txtfname.Text)
cmd.Parameters.AddWithValue("@lname", txtlname.Text)
cnt = cmd.ExecuteNonQuery()
Response.Write(cnt)
Response.Write(" " + "record(s) updated")
con.close()
--------------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim cnt As Integer = 0
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("SELECT PHONE FROM AUTHORS
where au_fname=@fname and au_lname=@lname", con)
cmd.Parameters.AddWithValue("@fname", txtfname.Text)
cmd.Parameters.AddWithValue("@lname", txtlname.Text)
txtphone.Text = cmd.ExecuteScalar()
con.close()
--------------------------------------------------------------
con.Open()
cmd = New OleDbCommand("select * from asp where
id = @id", con)
cmd.Parameters.AddWithValue("@id", txtID.Text)
dr = cmd.ExecuteReader
dr.Read()
txtLname.Text = dr("lastname")
txtState.Text = dr("stateorprovince")
txtCountry.Text = dr("country")
txtMobile.Text = dr("MobilePhone")
con.Close()
-----------------------------------------------
cmd = New OleDbCommand("insert into asp
(lastname , stateorprovince,country,mobilephone)
values(@lname ,@state,@country,@mobile)", con)
cmd.parameters.addwithvalue("@lastname" , txtlname.text)
cmd.parameters.addwithvalue("@state" , txtstate.text)
cmd.parameters.addwithvalue("@country" , txtcountry.text)
cmd.parameters.addwithvalue("@mobile , txtmobile.text)
cmd.executeNonquery
con.close()
--------------------------------------------------------
delete statement is used to delete record(s)
syntax:
delete from table_name where condition
delete from asp where id= @id
-------------------------------------------------
lblMessage.Text = ""
Dim cnt As Integer = 0
lblMessage.text =""
con.Open()
cmd = New OleDbCommand("DELETE FROM ASP WHERE ID =@ID", con)
cmd.Parameters.AddWithValue("@ID", txtID.Text)
cnt = cmd.ExecuteNonQuery
If (cnt > 0) Then
lblMessage.Text = "Record has been Deleted successfully"
Else
lblMessage.Text = "No Record Has been found"
End If
con.Close()
--------------------------------------------------------------
lblMessage.Text = ""
Dim cnt As Integer = 0
con.Open()
cmd = New OleDbCommand("Update asp set mobilephone=@phone",
con)
cmd.Parameters.AddWithValue("@phone", txtMobile.Text)
cnt = cmd.ExecuteNonQuery
If (cnt > 0) Then
lblMessage.Text = "Phone No has been Deleted successfully"
Else
lblMessage.Text = "No Record Has been found"
End If
con.Close()
------------------------------------------------
Protected Sub BTN_UPDATE_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles BTN_UPDATE.Click
lblMessage.Text = ""
Dim cnt As Integer = 0
con.Open()
cmd = New OleDbCommand("Update asp
set mobilephone=@phone where id=@id", con)
cmd.Parameters.AddWithValue("@phone", txtMobile.Text)
cmd.Parameters.AddWithValue("@id", txtID.Text)
cnt = cmd.ExecuteNonQuery
If (cnt > 0) Then
lblMessage.Text = "Phone No has been updatedsuccessfully"
Else
lblMessage.Text = "No Record Has been found"
End If
con.Close()
End Sub
----------------------------------------------------------
Protected Sub BTN_QUERY_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTN_QUERY.Click
con.Open()
lblMessage.Text = " "
txtLname.Text = ""
txtState.Text = " "
txtCountry.Text = " "
txtMobile.Text = " "
cmd = New OleDbCommand("select * from asp where id = @id",
con)
cmd.Parameters.AddWithValue("@id", txtID.Text)
dr = cmd.ExecuteReader
If dr.HasRows Then
dr.Read()
txtLname.Text = dr("lastname")
txtState.Text = dr("stateorprovince")
txtCountry.Text = dr("country")
txtMobile.Text = dr("MobilePhone")
Else
lblMessage.Text = "No Record Found"
End If
con.Close()
End Sub
Dim l1, l2, l3, l4 As Integer
l1 = (txtLname.Text).Length
l2 = (txtState.Text).Length
l3 = (txtCountry.Text).Length
l4 = (txtMobile.Text).Length
If (l1 > 0) And (l2 > 0) And (l3 > 0) And (l4 > 0) Then
cmd = New OleDbCommand("insert into asp
(lastname , stateorprovince,country,mobilephone)
values(@lname ,@state,@country,@mobile)", con)
cmd.Parameters.AddWithValue("@lastname", txtLname.Text)
cmd.Parameters.AddWithValue("@state", txtState.Text)
cmd.Parameters.AddWithValue("@country", txtCountry.Text)
cmd.Parameters.AddWithValue("@phone", txtMobile.Text)
cmd.ExecuteNonQuery()
Else
lblMessage.Text = "Data is blank and CAN NOT INSERTED"
End If
con.Close()
-------------------------------------------
create table db in MOHR database.
table contains the following columns
1. ICNO
2. NAME
3. SEX
---------------------------------------------
1. WRITE AN INTERFACE TO INSERT A RECORD
con.Open()
lblMESSAGE.Text = ""
cmd = New OleDbCommand("INSERT INTO DB (ICNO ,NAME, SEX)
VALUES (@IC ,@NAME, @SEX)", con)
cmd.Parameters.AddWithValue("@ic", txtICNO.Text)
cmd.Parameters.AddWithValue("@name", txtNAME.Text)
cmd.Parameters.AddWithValue("@sex", txtSEX.Text)
rec=cmd.ExecuteNonQuery
if (rec > 0 ) then
lblMessage.text="Record has been inserted Successfully"
else
lblMessage.text ="Record is not inserted"
End if
----------------------------------------------------------
Dim REC As Integer = 0
lblMESSAGE.Text = ""
con.Open()
cmd = New OleDbCommand(" SELECT * FROM DB WHERE ICNO=@NO", con)
cmd.Parameters.AddWithValue("@NO", txtICNO.Text)
dr = cmd.ExecuteReader
If dr.HasRows Then
DR.READ()
txtNAME.Text = dr("NAME")
TxtSEX.Text = dr("SEX")
else
lblMESSAGE.Text = "NO RECORD FOUND"
txtname.text=" "
txtsex.text=" "
End If
con.Close()
Data Binding
------------
Loading of items to the controls at the
runtime is known as DATA BINDING.
Controls can be DropDownList , ListBox , Checkbox List
and RadioButton List
-------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
Cmd = New OleDbCommand("select au_lname from authors", con)
dr = cmd.ExecuteReader
DDL1.DataSource = dr
DDL1.DATATEXTFIELD ="au_lname"
DDL1.DataBind()
DR.CLOSE()
con.Close()
End Sub
---------------------------------------------------------
Control : DropDownList - DDL2
DATABASE : PUBS
TABLE : AUTHORS
FIELD : STATE
DDL2 is binded to state field
---------------------------------------------------------
Order by field_name asc :sorting by ascending order
order by field_name :sorting by ascending order
Order by field_name desc :sorting by descending order
-----------------------------------------------------------
Control List : =RadioButton List
database = Nwind
Table = CATEGORIES
fieldname = CATEGORYNAME
-
-----------------------------------------------------------
Binding to checkboxList
-----------------------
Control : checkboxlist
Database : pubs
table : Titles
Field : Title
------------------------------------------------------------
Binding to ListBox Control
--------------------------
Control : ListBoxList
Database : NWIND
table : ProductName
Field : Products
---------------------------------------------------------- Understanding DataSets
----------------------
Unlike a DataReader , a dataset represents a disconnected
set of records.
Elements of datasets
--------------------
DataAdapter
DataSet
DataTable
DataRelation
DataView
- ---------------------------------------
dataset contains one or more datatables
Difference : database table and dataTable
DataAdapter : Class represents the bridge between
dataset and data source it. We use DataAdapter to
populate a dataset from an existing dataabase table.
---------------------------------------------------
Dim con As OleDbConnection
Dim dad As OleDbDataAdapter
Dim dst As DataSet
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\NWIND.mdb")
dad = New OleDataAdapter("Select * from Products", con)
dst = New DataSet
dad.fill(dst ,"Products")
GV1.DataSource=dst
GV1.DataBind()
---------------------------------------------------------------
Server Authentication
---------------------
con = new sqlconnection("server=localhost; uid=sa ;pwd=sa;
database=pubs"
con.open()
--------------------------------------------------------------
windows authentication
----------------------
con = new SqlConnection("server=localhost ;
Integrated Security=SSPI;
Initial Catalog=Northwind" )
---------------------------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
con = new SqlConnection("server=localhost ;
Integrated Security=SSPI;
Initial Catalog=DBX")
con.Open()
cmd = New SqlCommand("select NAME from dbo.x", con)
dr = cmd.ExecuteReader()
While dr.Read()
Response.Write(" ")
Response.Write(dr("NAME"))
End While
dr.Close()
con.Close()
End Sub
--------------------------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
con = New SqlConnection("Data Source=localhost;
Initial Catalog=Dbx;Integrated Security=SSPI")
con.Open()
cmd = New SqlCommand("select NAME from dbo.x", con)
dr = cmd.ExecuteReader()
While dr.Read()
Response.Write(" ")
Response.Write(dr("NAME"))
End While
dr.Close()
con.Close()
End Sub
---------windows Authentication----------------------------
con = New SqlConnection("Data Source=localhost;
Initial Catalog=adventureworks;
Integrated Security=SSPI")
---------------server Authentication-------------------------
con = New SqlConnection("server=localhost;uid=vb;pwd=dbx;
database=adventureworks")
------------------------------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
con = New SqlConnection("Data Source=localhost;
Initial Catalog=adventureworks;
Integrated Security=SSPI")
' con = New SqlConnection("server=localhost;
' uid=mohr; pwd=dbx; database=adventureworks")
con.Open()
cmd = New SqlCommand("select FirstName from
Person.Contact", con)
dr = cmd.ExecuteReader()
While dr.Read()
Response.Write(" ")
Response.Write(dr("FirstName"))
End While
dr.Close()
con.Close()
-------------------------------------------------------
question :
List EmployeeID , Title, MaritalStatus and sex
from HumanResources.Employee of Adventureworks database
having male sex and married
select EmployeeID , Title , MaritalStatus , Gender
From HumanResources.Employee
where Gender='F' and MaritalStatus ='M'
GRIDVIEW1.DATASOURCE = DR.EXECUTEREADER()
GRIDVIEW1.DATABIND()
------------------------------------------------------
MS-ACCES DATABASE : NWIND
TABLE Products ( ProductID, ProductName,categoryName)
TABLE CATEGORIES (categoryId , CategoryName)
output
----------------------------------------------------------
ProductID ProductName CategoryId CategoryName
-----------------------------------------------------------
when we want to populate data from two or more tables
find a common column that appears in two or more tables.
cmd = new oledbcommand("select Productid , productname,
products.categoryID , categoryName
from products , categories
where products.categoryid= categories.categoryid" ,con)
----------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\nwind.mdb")
con.Open()
cmd = New OleDbCommand("select Productid,productname,
products.categoryID,categoryName
from products, categories
where products.categoryid= categories.categoryid", con)
GridView1.DataSource = cmd.ExecuteReader()
GridView1.DataBind()
con.Close()
-----------------------------------------------------------
Use Nwind ms-access database of Employees
table to display EmployeeID , LastName
FirstName and Title whose city is London.
Display using Gridformat
Select EmployeeID , LastName , FirstName ,Title
From Employees
where city='London'
WORKING WITH XML
----------------
1. CREATE XML FILE
2. READING XML DATA USING ASP.NET
3. TRANSFORMING SQL SERVER DATA INTO XML FORMAT
4. CALLING SQL SERVER PROCEDURE IN ASP.NET
---------------------------------------------------
XML : Extensible Markup Language
Similar to HTML(Hypher Text Markup Language)
HTML is not Case sensitive.
XML is sensitive
Html has pre-defined tags
Xml has user defined tags
Html describes how to present data
XMl desribles the data.
XMl data is pure text file.
Any system can read pure text file
-----------------------------------------------------
Dim dst As DataSet
dst = new dataset
dst.ReadXml(MapPath("MENU.XML"))
gridview1.datasource =dst
gridview1.databind()
-------------------------------------------------------
Dim con As OleDbConnection
Dim dad As OleDbDataAdapter
Dim dst As DataSet
Dim strxml As String
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
dad = New OleDbDataAdapter("select * from authors", con)
dst = New DataSet()
dad.Fill(dst, "authors")
strxml = dst.GetXml()
response.write("
------------------------------------------------------
write asp.net program to convert into xml file
of products table from NWIND database , of those
category of type either "SeaFood" or "Meat/Poultry".
Store the xml file in c: drive
-------------------------------------------------------
"select ProductId, ProductName , Products.categoryid
, categoryName
from products, categories
where products.categoryid= categories.categoryid
and categoryname
in ('SeaFood' , 'Meat/Poultry')" ,con)
dad.fill(dst, "products")
dst.writexml("c:\products.xml")
response.write("Products file is saved")
-----------------------------------------------
TASK 1: draw dropdownlist control and add items
categoryname from categories table
of NWIND database.
----------------------------------------------------------
IsPostBack Property is false when the page
is loaded first time,
when the form is sent to back to server for processing
and sends back to client. once sent to client
again ispostback property is true.
----------------------------------------------------------
If Not IsPostBack Then
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\NWIND.mdb")
con.Open()
cmd = New OleDbCommand("Select categoryid , categoryname
from categories", con)
dr = cmd.ExecuteReader()
DDL1.DataSource = dr
DDL1.DataTextField = "Categoryname"
DDL1.DataValueField = "CATEGORYID"
DDL1.DataBind()
DDL1.ITEMS.INSERT(0, New ListItem("None Selected" , -1))
dr.Close()
con.Close()
End If
----------------------------------------------------------
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DDL1.SelectedIndexChanged
Dim catid As Integer
Dim con as Oledbconnection
DIm cmd as OledbCOmmand
Dim dr as OlddbReader
catid = DDL1.SelectedItem.Value
If catid <> -1 Then
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\NWIND.mdb")
con.Open()
cmd = New OleDbCommand("Select Productid ,ProductName
, UnitPrice from products where Categoryid=@id ", con)
cmd.Parameters.AddWithValue("@id", catid)
dr = cmd.ExecuteReader()
GridView1.DataSource = dr
GridView1.DataBind()
ELSE
GRIDVIEW1.DATASOURCE=""
GRIDVIEW1.DATABIND()
End If
End Sub
2. Text box[ txtrad ] - to enter value for radius
3. Button -[ Area & circum ] BTN_ARE_CIR
-----------------------------------------------
txtarea.Text = 3.14 * txtrad.Text * txtrad.Text
txtcir.Text = 2 * 3.14 * txtrad.Text
------------------------------------------------
whenever if we change the value of text ,
textchanged event is executed on its own.
--------------------------------------------------
Performing form validation with Validation Controls
---------------------------------------------------
By providing validation controls , we can
reduce the error made by the user. Errors are
reduced considerably , but not guaranteed that
we can elimiate 100 % errors.
Keeping more controls reduced the error levels
but at the same time , speed will be reduced.
1. server side validation[vb.net
2. client side validation[vbscript, javascript]
Server side validation
Demerits : network traffic , can not get thru,
Most of the time server busy in validation
Merits : More secured. No one can bypass the
validation
Client side:
------------
Demerits: Not secured. Smart programmers can by pass
the validation
merits : less network traffic
server side validation controls
-------------------------------
REQUIRED FIELD VALIDATOR
REGULAR EXPRESSION VALIDATOR
COMPARE VALIDATOR
RANGE VALIDATOR
VALIDATIONSUMMARY CONTROL VALIDATOR
CUSTOM VALIDATOR
REQUIRED FIELD VALIDATOR
------------------------
Used to check whether field is empty or not
Properties :
ControlToValidate
Text
Isvalid : Has the valid true when the validation
check succeeds and false otherwise
Compare Validator
-----------------
Performs comparisons between the data entered
into a form field and another value.
The other value can be fixed value , such
as particular number or value entered into another
control.
Properties :
ControlToValidate ,ControlToCompare,
IsValid , Operator , type , text
value to compare.
VALIDATIONS
1. Amount field shoul not be empty.
2. Entererd value must be more than 2300.
Include Neccessary validation controls to
achieve the two goas 1 and 2
hint: use Required field validator for
the validation 1.
Use compare validator for validation 2
ControlToValidate = txtamt
ValueToCompare = 2300
type = Money
Operator = Greater than
text = Must be greater than 2300
--------------------------------------------------------
REGULAR EXPRESSION - CONTROL
----------------------------
This is used to validate like phone number ,
email address, postal code , code number etc.
Property : controlToValidate , text
, ValidationExpression.
symbols used
-------------
[ ] - Range
[0-4] -Can be any numbers form 0 to 4.
{ } - Exact length
{2} - Exact length 2
+ - one or more characters
* - zero or more characters
--------------------------------------------------------
P[0-9]{4}- P followed by 4 digits lenth
[pP][0-9]{4} - Either lower case p or Upper case P
followed by 4 digits lenth
[^0][0-9]{4}
[^0] = not zero included
[^0^a-z^A-Z][0-9]{4}
----------------------------------------------------
RangeValidator:
Property : controlTovalidate , type , text ,
MinimumValue , MaximumValue
------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
con = New OleDbconnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.open()
cmd = New oledbcommand("Select au_lname ,STATE
from authors WHERE STATE='CA' " ,con)
dr = cmd.ExecuteReader()
while dr.read()
Response.write("
Response.write(dr("au_lname")+ " ")
Response.write(dr("STATE"))
End While
dr.close()
con.close()
---------------------------------------------------
List au_lname , STATE from authors table who stay
in state "CA"
SELECT AU_LNAME , STATE FROM AUTHORS WHERE STATE="CA"
--------------------------------------------------------
ExecuteScalar is used to if it fetches only one record,
Example: count , min , max , total
avg .. etc
select count(*) from authors - Returns total records
in the table.
select min(salary) from authors - Returns minimum salary
in the table.
------------------------------------------------------
question 3 : Display the number of records from
the authors table of pubs database.
Output
There are 23 records in the authors table
-------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("select count(*) from authors", con)
LBLCOUNT.Text = cmd.ExecuteScalar()
con.Close()
--------------------------------------------------------
Display au_lname , state those who stay
in any one of the states (CA ,KS,IN)
-------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("select * from titles ", con)
GV1.DataSource = cmd.ExecuteReader()
GV1.DataBind()
con.Close()
----------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = new oledbcommand("select phone from authors
where au_fname=@fname and au_lname =@lname" ,con)
cmd.parameters.add("@fname" , txtfname.text)
cmd.parameters.add("@lname" , txtlname.text)
txtphone.text = cmd.executescalar()
con.close()
-----------------------------------------------------------
fname = ann
lastname = dull
----------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("select * from titles where type =@type", con)
cmd.Parameters.Add("@type", txttype.Text)
GV1.DataSource = cmd.ExecuteReader()
GV1.DataBind()
con.Close()
--------------------------------------------------
update statement
----------------
we want to update phone field of authors table with
new phone number for a given first name and last name
update table_name set field = value
where condition
UPDATE authors set phone = @newPhone
where au_fname=@fname and au_lname=@lname
----------------------------------------------
executeNonQuery is a method used to insert , update
and for delete statements
cmd.executeNonquery()
----------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim cnt As Integer = 0
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("update authors set phone=@phone
where au_fname=@fname and au_lname=@lname", con)
cmd.Parameters.AddWithValue("@phone", txtphone.Text)
cmd.Parameters.AddWithValue("@fname", txtfname.Text)
cmd.Parameters.AddWithValue("@lname", txtlname.Text)
cnt = cmd.ExecuteNonQuery()
Response.Write(cnt)
Response.Write(" " + "record(s) updated")
con.close()
--------------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim cnt As Integer = 0
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
cmd = New OleDbCommand("SELECT PHONE FROM AUTHORS
where au_fname=@fname and au_lname=@lname", con)
cmd.Parameters.AddWithValue("@fname", txtfname.Text)
cmd.Parameters.AddWithValue("@lname", txtlname.Text)
txtphone.Text = cmd.ExecuteScalar()
con.close()
--------------------------------------------------------------
con.Open()
cmd = New OleDbCommand("select * from asp where
id = @id", con)
cmd.Parameters.AddWithValue("@id", txtID.Text)
dr = cmd.ExecuteReader
dr.Read()
txtLname.Text = dr("lastname")
txtState.Text = dr("stateorprovince")
txtCountry.Text = dr("country")
txtMobile.Text = dr("MobilePhone")
con.Close()
-----------------------------------------------
cmd = New OleDbCommand("insert into asp
(lastname , stateorprovince,country,mobilephone)
values(@lname ,@state,@country,@mobile)", con)
cmd.parameters.addwithvalue("@lastname" , txtlname.text)
cmd.parameters.addwithvalue("@state" , txtstate.text)
cmd.parameters.addwithvalue("@country" , txtcountry.text)
cmd.parameters.addwithvalue("@mobile , txtmobile.text)
cmd.executeNonquery
con.close()
--------------------------------------------------------
delete statement is used to delete record(s)
syntax:
delete from table_name where condition
delete from asp where id= @id
-------------------------------------------------
lblMessage.Text = ""
Dim cnt As Integer = 0
lblMessage.text =""
con.Open()
cmd = New OleDbCommand("DELETE FROM ASP WHERE ID =@ID", con)
cmd.Parameters.AddWithValue("@ID", txtID.Text)
cnt = cmd.ExecuteNonQuery
If (cnt > 0) Then
lblMessage.Text = "Record has been Deleted successfully"
Else
lblMessage.Text = "No Record Has been found"
End If
con.Close()
--------------------------------------------------------------
lblMessage.Text = ""
Dim cnt As Integer = 0
con.Open()
cmd = New OleDbCommand("Update asp set mobilephone=@phone",
con)
cmd.Parameters.AddWithValue("@phone", txtMobile.Text)
cnt = cmd.ExecuteNonQuery
If (cnt > 0) Then
lblMessage.Text = "Phone No has been Deleted successfully"
Else
lblMessage.Text = "No Record Has been found"
End If
con.Close()
------------------------------------------------
Protected Sub BTN_UPDATE_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles BTN_UPDATE.Click
lblMessage.Text = ""
Dim cnt As Integer = 0
con.Open()
cmd = New OleDbCommand("Update asp
set mobilephone=@phone where id=@id", con)
cmd.Parameters.AddWithValue("@phone", txtMobile.Text)
cmd.Parameters.AddWithValue("@id", txtID.Text)
cnt = cmd.ExecuteNonQuery
If (cnt > 0) Then
lblMessage.Text = "Phone No has been updatedsuccessfully"
Else
lblMessage.Text = "No Record Has been found"
End If
con.Close()
End Sub
----------------------------------------------------------
Protected Sub BTN_QUERY_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTN_QUERY.Click
con.Open()
lblMessage.Text = " "
txtLname.Text = ""
txtState.Text = " "
txtCountry.Text = " "
txtMobile.Text = " "
cmd = New OleDbCommand("select * from asp where id = @id",
con)
cmd.Parameters.AddWithValue("@id", txtID.Text)
dr = cmd.ExecuteReader
If dr.HasRows Then
dr.Read()
txtLname.Text = dr("lastname")
txtState.Text = dr("stateorprovince")
txtCountry.Text = dr("country")
txtMobile.Text = dr("MobilePhone")
Else
lblMessage.Text = "No Record Found"
End If
con.Close()
End Sub
Dim l1, l2, l3, l4 As Integer
l1 = (txtLname.Text).Length
l2 = (txtState.Text).Length
l3 = (txtCountry.Text).Length
l4 = (txtMobile.Text).Length
If (l1 > 0) And (l2 > 0) And (l3 > 0) And (l4 > 0) Then
cmd = New OleDbCommand("insert into asp
(lastname , stateorprovince,country,mobilephone)
values(@lname ,@state,@country,@mobile)", con)
cmd.Parameters.AddWithValue("@lastname", txtLname.Text)
cmd.Parameters.AddWithValue("@state", txtState.Text)
cmd.Parameters.AddWithValue("@country", txtCountry.Text)
cmd.Parameters.AddWithValue("@phone", txtMobile.Text)
cmd.ExecuteNonQuery()
Else
lblMessage.Text = "Data is blank and CAN NOT INSERTED"
End If
con.Close()
-------------------------------------------
create table db in MOHR database.
table contains the following columns
1. ICNO
2. NAME
3. SEX
---------------------------------------------
1. WRITE AN INTERFACE TO INSERT A RECORD
con.Open()
lblMESSAGE.Text = ""
cmd = New OleDbCommand("INSERT INTO DB (ICNO ,NAME, SEX)
VALUES (@IC ,@NAME, @SEX)", con)
cmd.Parameters.AddWithValue("@ic", txtICNO.Text)
cmd.Parameters.AddWithValue("@name", txtNAME.Text)
cmd.Parameters.AddWithValue("@sex", txtSEX.Text)
rec=cmd.ExecuteNonQuery
if (rec > 0 ) then
lblMessage.text="Record has been inserted Successfully"
else
lblMessage.text ="Record is not inserted"
End if
----------------------------------------------------------
Dim REC As Integer = 0
lblMESSAGE.Text = ""
con.Open()
cmd = New OleDbCommand(" SELECT * FROM DB WHERE ICNO=@NO", con)
cmd.Parameters.AddWithValue("@NO", txtICNO.Text)
dr = cmd.ExecuteReader
If dr.HasRows Then
DR.READ()
txtNAME.Text = dr("NAME")
TxtSEX.Text = dr("SEX")
else
lblMESSAGE.Text = "NO RECORD FOUND"
txtname.text=" "
txtsex.text=" "
End If
con.Close()
Data Binding
------------
Loading of items to the controls at the
runtime is known as DATA BINDING.
Controls can be DropDownList , ListBox , Checkbox List
and RadioButton List
-------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
Cmd = New OleDbCommand("select au_lname from authors", con)
dr = cmd.ExecuteReader
DDL1.DataSource = dr
DDL1.DATATEXTFIELD ="au_lname"
DDL1.DataBind()
DR.CLOSE()
con.Close()
End Sub
---------------------------------------------------------
Control : DropDownList - DDL2
DATABASE : PUBS
TABLE : AUTHORS
FIELD : STATE
DDL2 is binded to state field
---------------------------------------------------------
Order by field_name asc :sorting by ascending order
order by field_name :sorting by ascending order
Order by field_name desc :sorting by descending order
-----------------------------------------------------------
Control List : =RadioButton List
database = Nwind
Table = CATEGORIES
fieldname = CATEGORYNAME
-
-----------------------------------------------------------
Binding to checkboxList
-----------------------
Control : checkboxlist
Database : pubs
table : Titles
Field : Title
------------------------------------------------------------
Binding to ListBox Control
--------------------------
Control : ListBoxList
Database : NWIND
table : ProductName
Field : Products
---------------------------------------------------------- Understanding DataSets
----------------------
Unlike a DataReader , a dataset represents a disconnected
set of records.
Elements of datasets
--------------------
DataAdapter
DataSet
DataTable
DataRelation
DataView
- ---------------------------------------
dataset contains one or more datatables
Difference : database table and dataTable
DataAdapter : Class represents the bridge between
dataset and data source it. We use DataAdapter to
populate a dataset from an existing dataabase table.
---------------------------------------------------
Dim con As OleDbConnection
Dim dad As OleDbDataAdapter
Dim dst As DataSet
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\NWIND.mdb")
dad = New OleDataAdapter("Select * from Products", con)
dst = New DataSet
dad.fill(dst ,"Products")
GV1.DataSource=dst
GV1.DataBind()
---------------------------------------------------------------
Server Authentication
---------------------
con = new sqlconnection("server=localhost; uid=sa ;pwd=sa;
database=pubs"
con.open()
--------------------------------------------------------------
windows authentication
----------------------
con = new SqlConnection("server=localhost ;
Integrated Security=SSPI;
Initial Catalog=Northwind" )
---------------------------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
con = new SqlConnection("server=localhost ;
Integrated Security=SSPI;
Initial Catalog=DBX")
con.Open()
cmd = New SqlCommand("select NAME from dbo.x", con)
dr = cmd.ExecuteReader()
While dr.Read()
Response.Write("
Response.Write(dr("NAME"))
End While
dr.Close()
con.Close()
End Sub
--------------------------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
con = New SqlConnection("Data Source=localhost;
Initial Catalog=Dbx;Integrated Security=SSPI")
con.Open()
cmd = New SqlCommand("select NAME from dbo.x", con)
dr = cmd.ExecuteReader()
While dr.Read()
Response.Write("
Response.Write(dr("NAME"))
End While
dr.Close()
con.Close()
End Sub
---------windows Authentication----------------------------
con = New SqlConnection("Data Source=localhost;
Initial Catalog=adventureworks;
Integrated Security=SSPI")
---------------server Authentication-------------------------
con = New SqlConnection("server=localhost;uid=vb;pwd=dbx;
database=adventureworks")
------------------------------------------------------------
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
con = New SqlConnection("Data Source=localhost;
Initial Catalog=adventureworks;
Integrated Security=SSPI")
' con = New SqlConnection("server=localhost;
' uid=mohr; pwd=dbx; database=adventureworks")
con.Open()
cmd = New SqlCommand("select FirstName from
Person.Contact", con)
dr = cmd.ExecuteReader()
While dr.Read()
Response.Write("
Response.Write(dr("FirstName"))
End While
dr.Close()
con.Close()
-------------------------------------------------------
question :
List EmployeeID , Title, MaritalStatus and sex
from HumanResources.Employee of Adventureworks database
having male sex and married
select EmployeeID , Title , MaritalStatus , Gender
From HumanResources.Employee
where Gender='F' and MaritalStatus ='M'
GRIDVIEW1.DATASOURCE = DR.EXECUTEREADER()
GRIDVIEW1.DATABIND()
------------------------------------------------------
MS-ACCES DATABASE : NWIND
TABLE Products ( ProductID, ProductName,categoryName)
TABLE CATEGORIES (categoryId , CategoryName)
output
----------------------------------------------------------
ProductID ProductName CategoryId CategoryName
-----------------------------------------------------------
when we want to populate data from two or more tables
find a common column that appears in two or more tables.
cmd = new oledbcommand("select Productid , productname,
products.categoryID , categoryName
from products , categories
where products.categoryid= categories.categoryid" ,con)
----------------------------------------------------------
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\nwind.mdb")
con.Open()
cmd = New OleDbCommand("select Productid,productname,
products.categoryID,categoryName
from products, categories
where products.categoryid= categories.categoryid", con)
GridView1.DataSource = cmd.ExecuteReader()
GridView1.DataBind()
con.Close()
-----------------------------------------------------------
Use Nwind ms-access database of Employees
table to display EmployeeID , LastName
FirstName and Title whose city is London.
Display using Gridformat
Select EmployeeID , LastName , FirstName ,Title
From Employees
where city='London'
WORKING WITH XML
----------------
1. CREATE XML FILE
2. READING XML DATA USING ASP.NET
3. TRANSFORMING SQL SERVER DATA INTO XML FORMAT
4. CALLING SQL SERVER PROCEDURE IN ASP.NET
---------------------------------------------------
XML : Extensible Markup Language
Similar to HTML(Hypher Text Markup Language)
HTML is not Case sensitive.
XML is sensitive
Html has pre-defined tags
Xml has user defined tags
Html describes how to present data
XMl desribles the data.
XMl data is pure text file.
Any system can read pure text file
-----------------------------------------------------
Dim dst As DataSet
dst = new dataset
dst.ReadXml(MapPath("MENU.XML"))
gridview1.datasource =dst
gridview1.databind()
-------------------------------------------------------
Dim con As OleDbConnection
Dim dad As OleDbDataAdapter
Dim dst As DataSet
Dim strxml As String
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\pubs.mdb")
con.Open()
dad = New OleDbDataAdapter("select * from authors", con)
dst = New DataSet()
dad.Fill(dst, "authors")
strxml = dst.GetXml()
response.write("
" & server.htmlEncode(strxml) & "")
------------------------------------------------------
write asp.net program to convert into xml file
of products table from NWIND database , of those
category of type either "SeaFood" or "Meat/Poultry".
Store the xml file in c: drive
-------------------------------------------------------
"select ProductId, ProductName , Products.categoryid
, categoryName
from products, categories
where products.categoryid= categories.categoryid
and categoryname
in ('SeaFood' , 'Meat/Poultry')" ,con)
dad.fill(dst, "products")
dst.writexml("c:\products.xml")
response.write("Products file is saved")
-----------------------------------------------
TASK 1: draw dropdownlist control and add items
categoryname from categories table
of NWIND database.
----------------------------------------------------------
IsPostBack Property is false when the page
is loaded first time,
when the form is sent to back to server for processing
and sends back to client. once sent to client
again ispostback property is true.
----------------------------------------------------------
If Not IsPostBack Then
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\NWIND.mdb")
con.Open()
cmd = New OleDbCommand("Select categoryid , categoryname
from categories", con)
dr = cmd.ExecuteReader()
DDL1.DataSource = dr
DDL1.DataTextField = "Categoryname"
DDL1.DataValueField = "CATEGORYID"
DDL1.DataBind()
DDL1.ITEMS.INSERT(0, New ListItem("None Selected" , -1))
dr.Close()
con.Close()
End If
----------------------------------------------------------
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DDL1.SelectedIndexChanged
Dim catid As Integer
Dim con as Oledbconnection
DIm cmd as OledbCOmmand
Dim dr as OlddbReader
catid = DDL1.SelectedItem.Value
If catid <> -1 Then
con = New OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;
Data Source=c:\NWIND.mdb")
con.Open()
cmd = New OleDbCommand("Select Productid ,ProductName
, UnitPrice from products where Categoryid=@id ", con)
cmd.Parameters.AddWithValue("@id", catid)
dr = cmd.ExecuteReader()
GridView1.DataSource = dr
GridView1.DataBind()
ELSE
GRIDVIEW1.DATASOURCE=""
GRIDVIEW1.DATABIND()
End If
End Sub
BUSINESS ETHIC AND VALUE : ETHICS, VALUES AND THE MANAGER
ETHICS, VALUES AND THE MANAGER
OVERVIEW
=THE MANAGER AS AN INDIVIDUAL
=THE MANAGER AS AN AGENT
=THE MANAGER AS A MORAL LEADER
THE MANAGER AS AN INDIVIDUAL
Conscience
-the moral compass of a human being
-provides the inner voice, which senses right and wrong actions and activates the alarm when an action is on the wrong track
-it is an 'obstacle' against questionable conduct
-a manager must be guided by his or her conscience
Self-interest
-Self-interest is the sense of wanting to do or accomplish something that is advantageous and of interest to own self only
-In economics or businesses, self-interest serves as a source of motivation to decide on a particular course of action (Adam Smith)
-Acting to maximize self-interest is considered rational in the sphere of economics and business especially if it is in the long-term interest of the individual firm or person - enlightened self-interest.
Integrity
-What is integrity? Ordinarily, integrity has been associated with sincerity, trustworthiness, and honesty
-Integrity is the culmination of the development of intellectual and moral virtues in a person
-A person is considered to have a good character when all virtues are integrated in his personality or what some philosophers call unity of virtues
Integrity has two traits, namely humility and courage
-In business, values such as honesty, quality, profitability, sensitivity, sincerity, and high ethical and moral standards, are very important.
-Every individual in an organization should know how to integrate this set of corporate values into day to day practices aligned with corporate principles. By so doing, they can accomplish integrity in their own selves, which then leads to the integrity of the corporation as a whole.
THE MANAGER AS AN AGENT
-Agency in the context of managerial roles refers to managers as economic agents of the organizations they represent
-Two basic roles of managers include:
==member of a family, as a father or a mother, and as a husband or a wife, who is bound by economic, religious and cultural values, and
==member of a group, who is expected to share and contribute to achieving the organization's goals.
Agency roles:
Planning, organizing, and budgeting,
Decision-making,
Managing people,
Informational tasks,
Taking care of employees' welfare, and
Leading and building performing teams.
Agency Problem
Agency relationship can be defined as a contract between principals (owners/shareholders) of a firm and an agent (manager)
Agency problems arise when there is a conflict between a firm's managers and its shareholders such that the goals of the principals are not among the agents' priorities
Examples of Agency Problems
Communication breakdowns between the management and owners,
Conflicting principles and ethical values between the management and owners
Conflicts between company and personal values
How to handle?
implementing the share option scheme, which gives a share of ownership to the managers,
introducing performance bonuses, and
monitoring managers' performances, for instance, by constantly auditing their records
THE MANAGER AS A MORAL LEADER
The features of leadership are:
power,
value-laden,
followers and leaders,
changes toward betterment, and
mutual goals and purpose.
Amongst the leadership qualities are:
integrity, prudence, sharing of core values and purposes,
inspiring others, including followers and associates through stories of identity,
encouraging communication and providing mechanisms for voicing opinions,
defining, planning and carrying out business strategies effectively in line with core purposes,
willing to take risks,
having long term goals and visions, and
encouraging others to not give up and learn from mistakes.
The core purpose of an organization is the reason for its being or the reason for the organization's existence
The core values of organizations are the things that make the organizations what they are and these values define the scope of the organizations' goals
OVERVIEW
=THE MANAGER AS AN INDIVIDUAL
=THE MANAGER AS AN AGENT
=THE MANAGER AS A MORAL LEADER
THE MANAGER AS AN INDIVIDUAL
Conscience
-the moral compass of a human being
-provides the inner voice, which senses right and wrong actions and activates the alarm when an action is on the wrong track
-it is an 'obstacle' against questionable conduct
-a manager must be guided by his or her conscience
Self-interest
-Self-interest is the sense of wanting to do or accomplish something that is advantageous and of interest to own self only
-In economics or businesses, self-interest serves as a source of motivation to decide on a particular course of action (Adam Smith)
-Acting to maximize self-interest is considered rational in the sphere of economics and business especially if it is in the long-term interest of the individual firm or person - enlightened self-interest.
Integrity
-What is integrity? Ordinarily, integrity has been associated with sincerity, trustworthiness, and honesty
-Integrity is the culmination of the development of intellectual and moral virtues in a person
-A person is considered to have a good character when all virtues are integrated in his personality or what some philosophers call unity of virtues
Integrity has two traits, namely humility and courage
-In business, values such as honesty, quality, profitability, sensitivity, sincerity, and high ethical and moral standards, are very important.
-Every individual in an organization should know how to integrate this set of corporate values into day to day practices aligned with corporate principles. By so doing, they can accomplish integrity in their own selves, which then leads to the integrity of the corporation as a whole.
THE MANAGER AS AN AGENT
-Agency in the context of managerial roles refers to managers as economic agents of the organizations they represent
-Two basic roles of managers include:
==member of a family, as a father or a mother, and as a husband or a wife, who is bound by economic, religious and cultural values, and
==member of a group, who is expected to share and contribute to achieving the organization's goals.
Agency roles:
Planning, organizing, and budgeting,
Decision-making,
Managing people,
Informational tasks,
Taking care of employees' welfare, and
Leading and building performing teams.
Agency Problem
Agency relationship can be defined as a contract between principals (owners/shareholders) of a firm and an agent (manager)
Agency problems arise when there is a conflict between a firm's managers and its shareholders such that the goals of the principals are not among the agents' priorities
Examples of Agency Problems
Communication breakdowns between the management and owners,
Conflicting principles and ethical values between the management and owners
Conflicts between company and personal values
How to handle?
implementing the share option scheme, which gives a share of ownership to the managers,
introducing performance bonuses, and
monitoring managers' performances, for instance, by constantly auditing their records
THE MANAGER AS A MORAL LEADER
The features of leadership are:
power,
value-laden,
followers and leaders,
changes toward betterment, and
mutual goals and purpose.
Amongst the leadership qualities are:
integrity, prudence, sharing of core values and purposes,
inspiring others, including followers and associates through stories of identity,
encouraging communication and providing mechanisms for voicing opinions,
defining, planning and carrying out business strategies effectively in line with core purposes,
willing to take risks,
having long term goals and visions, and
encouraging others to not give up and learn from mistakes.
The core purpose of an organization is the reason for its being or the reason for the organization's existence
The core values of organizations are the things that make the organizations what they are and these values define the scope of the organizations' goals
Subscribe to:
Posts (Atom)