Posts

Showing posts with the label Database Oracle or MS Access or Mysql or MsSQL

Class Test questions of computer networking or internet and intranet application

Class Test 2 F.M 20 P.S 10 1 Which if the following address is the broadcast address of the class b ip address a. 147.255.255.255 b. 147.14.255.255 c. 147.13.0.0 d. 147.1.1.1 2 How many host addresses are available to a class C network a 254 b 255 c 256 d 128 3 How many useable subnets are created in a class C network when 5 bits are borrowed a 14 b 16 c 30 d 32 4 What is the minimum no of bits that can be borrowed to form useable subnets a.1 b 2 c 4 d 8 5 How many bits are in a subnet mask a. 16 b. 32 c. 64 d. 128 6 What is the maximum no of bits that can be borrowed to create the subnets in a class C network a. 2 b 4 c 6 d 7 7 With an ipaddress 202.211.19.162 and a subnet mask of 255.255.255.224 how many bits have been borrowed to create subnets a. 1 b. 2 c. 3 d. 4 8 What is the subnet of the class B address when 4 bits are borrowed? a. 255.240.0.0 b. 255.255.0.0 c. 255.255.240.0 d. 255.255.255.0 9 For what purpose does the ro

Joining Tables in database (inner join)

Joining tables:    Joins are a fundamental aspect of relation databases. They allow us to extract data on intites related by design represented by related tables in our data. A join occurs when you retrieve data from tables related by some shared data, often a shared reference number or index. Foe example, if you have a table of customers as a table of orders, good design in a relation database will ensure that the two are related together by some common data between the tables, perhaps by storing a customer number on every order record . By performing a join, you can retrieve information in a result set where each row combines data from both tables: information about each order will be combined with information about the customer who placed it, and the combination will appear as such in the result set.  INNER JOIN:     IT IS THE MOST COMMON TYPE OF JOIN. WHEN YOU PERFORM AS INNER JOIN BETWEEN tables, rows with matching values are put into the resu

Data types in database with description

Image
Data types     Mysql can handle the following data types:   Numeric values String values Data and time values The null values Numeric column types   The mysql can represent both integers (number with no fractional part) and floating point numbers (those with fractional part). Numeric column attributes    When declaring a numeric column not only can the column name and type be specified but also some column attributes. Column_ name column_ type [column _attributes] [genersl_arribute] Zero fill: it can be used with any numeric column type. Whenever displaying a value of a column with zero fill specified “the output will be padded with leading zero up to the display width of the column. Auto_ increment   We can use the auto_ increment attribute to generate a unique alto numbered identifier.   Mysql permits only one auto_ increment column per table and requires that it is also declared as a key. ‘By default an auto increment column will have it’s start

Retrieving Schema Information from the Data Source

Image
Retrieving Schema Information from the Data Source Schema information can be retrieved from a data source using the FillSchema( ) method, which retrieves the schema information for the SQL statement in the SelectCommand . The method adds a DataTable to the DataSet and adds DataColumn objects to that table. Finally, it configures the AllowDBNull , AutoIncrement , MaxLength , ReadOnly , and Unique properties of the DataColumn , based on the data source. While it configures the AutoIncrement property, it doesn't set the AutoIncrementSeed and AutoIncrementStep properties. The FillSchema( ) method also configures the primary key and unique constraints for the DataTable . It doesn't configure the DefaultValue property. In addition to an argument specifying the DataSet argument, the FillSchema( ) method takes an argument specifying whether the schema is transformed by the table mappings for the data adapter. Mapping tables and columns

Creating DataAdapter Object

Creating DataAdapter Object The overloaded constructor for the DataAdapter allows four different ways to create the data adapter, of which two are most commonly used. The following example creates a DataAdapter specifying the SELECT statement and connection string in the constructor. String connString = "Data Source=(local);Integrated security=SSPI;" +     "Initial Catalog=Northwind;"; String selectSql = "SELECT * FROM Orders";   SqlDataAdapter da = new SqlDataAdapter(selectSql, connString); While this approach is common, it is awkward when using parameterized queries or stored procedures. The following example creates a DataAdapter specifying a Command object for the SelectCommand property of the DataAdapter in the constructor: // create the Connection String connString = "Data Source = (local);Integrated security = SSPI;" +     "Initial Catalog = Northwind;"; SqlConnection conn = new SqlConn

AcceptChanges and RejectChanges

AcceptChanges and RejectChanges The AcceptChanges( ) and RejectChanges( ) methods either accept or reject the changes that have been made to the DataSet since it was last loaded from the data source or since AcceptChanges( ) was last called. The AcceptChanges( ) method commits all pending changes within the DataSet . Calling AcceptChanges( ) changes the RowState of Added and Modified rows to Unchanged . Deleted rows are removed. The Original values for the DataRow are set to the Current values. Calling the AcceptChanges( ) method has no effect on the data in the underlying data source. The AcceptChanges( ) method is implicitly called on a row when the DataAdapter successfully updates that row back to the data source when the Update( ) method is called. As a result, when a DataAdapter is used to update the data source with the changes made to the DataSet , AcceptChanges( ) doesn't need to be called. Calling AcceptChanges( ) o

Adding Custom Information

Adding Custom Information The DataSet contains a PropertyCollection that is exposed through the ExtendedProperties property. This collection allows a user to add custom information to the DataSet such as the date and time when the DataSet should be refreshed. The following example sets an extended property indicating that the DataSet should be refreshed in 20 minutes: ds.ExtendedProperties.Add("RefreshDateTime",     DateTime.Now.AddMinutes(20).ToString()); The following code can then check that value to see if the DataSet needs to be refreshed: if(DateTime.Now>Convert.ToDateTime(     ds.ExtendedProperties["RefreshDateTime"].ToString( ) )) {     // ... code to refresh the DataSet } Extended properties must be of type String , or else they will not persist when the DataSet is written as XML. The DataTable , DataColumn , DataRelation , and Constraint objects also have a similar collection of extended properties. Cloning

Adding and Removing Relations

Adding and Removing Relations Relations belonging to the DataSet are stored as DataRelation objects in a DataRelationCollection object and are accessed through the Relations property of the DataSet . Each DataRelation object represents the relationship between a parent and child table in the DataSet . This section examines some methods and properties of the DataRelationCollection . Relations are added to the DataSet using the Add( ) method of the DataRelationCollection , as shown in the following example: ds.Relations.Add("MyDataRelation", parentTable.Columns["PrimaryKeyField"],     childTable.Columns["ForeignKeyField"]); The Remove( ) method removes a relation matching the relation-name argument. The following example removes the relation added in the previous example: ds.Relations.Remove("MyDataRelation"); The Contains( ) method can determine if a specific relation exists as shown in the following