Skip to main content

Posts

Showing posts from October, 2018

SQL Server: SELECT Statement

Description The SQL Server (Transact-SQL) SELECT statement is used to retrieve records from one or more tables in a SQL Server database. Syntax In its simplest form, the syntax for the SELECT statement in SQL Server (Transact-SQL) is: SELECT expressions FROM tables [WHERE conditions]; However, the full syntax for the SELECT statement in SQL Server (Transact-SQL) is: SELECT [ ALL | DISTINCT ] [ TOP (top_value) [ PERCENT ] [ WITH TIES ] ] expressions FROM tables [WHERE conditions] [GROUP BY expressions] [HAVING condition] [ORDER BY expression [ ASC | DESC ]]; Parameters or Arguments ALL Optional. Returns all matching rows. DISTINCT Optional. Removes duplicates from the result set. Learn more about the  DISTINCT clause TOP (top_value) Optional. If specified, it will return the top number of rows in the result set based on  top_value . For example, TOP(10) would return the top 10 rows from the full result set. PERCENT Optional. If specified, then the...

SQL Server - Functions

What is a function in SQL Server? In SQL Server, a function is a stored program that you can pass parameters into and return a value. Create Function You can create your own functions in SQL Server (Transact-SQL). Let's take a closer look. Syntax The syntax to create a function in SQL Server (Transact-SQL) is: CREATE FUNCTION [schema_name.]function_name ( [ @parameter [ AS ] [type_schema_name.] datatype [ = default ] [ READONLY ] , @parameter [ AS ] [type_schema_name.] datatype [ = default ] [ READONLY ] ] ) RETURNS return_datatype [ WITH { ENCRYPTION | SCHEMABINDING | RETURNS NULL ON NULL INPUT | CALLED ON NULL INPUT | EXECUTE AS Clause ] [ AS ] BEGIN [declaration_section] executable_section RETURN return_value END; schema_name The name of the schema that owns the function. function_name The name to assign to this function in SQL Server. @parameter One or more parameters passed into the function. type_...

SQL Server - Functions

What is a function in SQL Server? In SQL Server, a function is a stored program that you can pass parameters into and return a value. Create Function You can create your own functions in SQL Server (Transact-SQL). Let's take a closer look. Syntax The syntax to create a function in SQL Server (Transact-SQL) is: CREATE FUNCTION [schema_name.]function_name ( [ @parameter [ AS ] [type_schema_name.] datatype [ = default ] [ READONLY ] , @parameter [ AS ] [type_schema_name.] datatype [ = default ] [ READONLY ] ] ) RETURNS return_datatype [ WITH { ENCRYPTION | SCHEMABINDING | RETURNS NULL ON NULL INPUT | CALLED ON NULL INPUT | EXECUTE AS Clause ] [ AS ] BEGIN [declaration_section] executable_section RETURN return_value END; schema_name The name of the schema that owns the function. function_name The name to assign to this function in SQL Server. @parameter One or more parameters passed into the function. type_...

Introduction to SQL Server

What is a procedure in SQL Server? In SQL Server, a procedure is a stored program that you can pass parameters into. It does not return a value like a function does. However, it can return a success/failure status to the procedure that called it. Create Procedure You can create your own stored procedures in SQL Server (Transact-SQL). Let's take a closer look. Syntax The syntax to create a stored procedure in SQL Server (Transact-SQL) is: CREATE { PROCEDURE | PROC } [schema_name.]procedure_name [ @parameter [type_schema_name.] datatype [ VARYING ] [ = default ] [ OUT | OUTPUT | READONLY ] , @parameter [type_schema_name.] datatype [ VARYING ] [ = default ] [ OUT | OUTPUT | READONLY ] ] [ WITH { ENCRYPTION | RECOMPILE | EXECUTE AS Clause } ] [ FOR REPLICATION ] AS BEGIN [declaration_section] executable_section END; schema_name The name of the schema that owns the stored procedure. procedure_name The name to assign to this procedure in S...

Introduction to SQL Server

Microsoft SQL Server  is a  relational database management system  developed by  Microsoft . As a  database server , it is a  software product  with the primary function of storing and retrieving data as requested by other  software applications —which may run either on the same computer or on another computer across a network (including the Internet). Microsoft markets at least a dozen different editions of Microsoft SQL Server, aimed at different audiences and for workloads ranging from small single-machine applications to large Internet-facing applications with many  concurrent users Architecture The protocol layer implements the external interface to SQL Server. All operations that can be invoked on SQL Server are communicated to it via a Microsoft-defined format, called  Tabular Data Stream  (TDS). TDS is an application layer protocol, used to transfer data between a database server and a client. Initially design...

TableLayout Example

activity_tableview <?xml version="1.0" encoding="utf-8"?> <LinearLayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     xmlns:android="http://schemas.android.com/apk/res/android">    <!-- <SearchView         android:id="@+id/searchView"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:queryHint="Search Here"         android:iconifiedByDefault="false"         android:layout_alignParentTop="true"         />--> <!--<LinearLayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="horizontal">     <Edi...

Table Layout

Android TableLayout going to be arranged groups of views into rows and columns. You will use the <TableRow> element to build a row in the table. Each row has zero or more cells; each cell can hold one View object. TableLayout containers do not display border lines for their rows, columns, or cells. TableLayout Attributes Following are the important attributes specific to TableLayout − Sr.No. Attribute & Description 1 android:id This is the ID which uniquely identifies the layout. 2 android:collapseColumns This specifies the zero-based index of the columns to collapse. The column indices must be separated by a comma: 1, 2, 5. 3 android:shrinkColumns The zero-based index of the columns to shrink. The column indices must be separated by a comma: 1, 2, 5. 4 android:stretchColumns The zero-based index of the columns to stretch. The column indices must be separated by a comma: 1, 2, 5.

Refresh page or Reload the activity

Refresh page or reload activity in android means once data entered, if someone want to clear the data and want to enter the new data can be done through this function. As in the project once data is entered by the farmers and want to edit the respective data can refresh the page through cancel button and can fill in the valid details again. We can refresh the code by the following code on the click of the button. first we have to give the intent of same activity i.e. intent from one to the same activity. Intent refresh = new Intent(SoilQuality. this , SoilQuality. class ); After giving intent then we have to start our activity to proceed further. startActivity(refresh); Once activity is done and no longer required then we have to finish the activity by using the finish function. finish();

Menu bar

For all menu types, Android provides a standard XML format to define menu items. Instead of building a menu in your activity's code, you should define a menu and all its items in an XML  menu resource . You can then inflate the menu resource (load it as a  Menu  object) in your activity or fragment. Using a menu resource is a good practice for a few reasons: It's easier to visualize the menu structure in XML. It separates the content for the menu from your application's behavioral code. It allows you to create alternative menu configurations for different platform versions, screen sizes, and other configurations by leveraging the  app resources  framework. <?xml version="1.0" encoding="utf-8"?> <LinearLayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     androi...

Custom listview

As the simple ListView, custom ListView also uses Adapter classes which added the content from data source (such as string array, array, database etc). Adapter bridges data between an AdapterViews and other Views Clu List Xml code: <?xml version="1.0" encoding="utf-8"?> <ListView xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:dividerHeight="10dp"     android:divider="@android:color/transparent"     android:padding="16dp"     android:id="@+id/list"     android:orientation="vertical"     tools:context="com.deeparora.po.CluList"> </ListView> Java code for CLU List: package com.deeparora.po; import and...

Functions used in webview

Apart from just loading url, you can have more control over your WebView by using the methods defined in WebView class. They are listed as follows − Sr.No Method & Description 1 canGoBack() This method specifies the WebView has a back history item. 2 canGoForward() This method specifies the WebView has a forward history item. 3 clearHistory() This method will clear the WebView forward and backward history. 4 destroy() This method destroy the internal state of WebView. 5 findAllAsync(String find) This method find all instances of string and highlight them. 6 getProgress() This method gets the progress of the current page. 7 getTitle() This method return the title of the current page. 8 getUrl() This method return the url of the current page. If you click on any link inside the webpage of the WebView, that page will not be loaded inside your WebView. In order to do that you need to extend your class from  WebViewClient  and ov...