Tuesday 29 April 2014

MVC Introduction(Model View Controller)

The MVC Programming Model MVC is one of three ASP.NET programming models.
MVC is a framework for building web applications using a MVC (Model View Controller) design:

                 The Model represents the application core (for instance a list of database records).
The View displays the data (the database records).

The Controller handles the input (to the database
records). The MVC model also provides full control over HTML, CSS, and JavaScript. The MVC model defines web applications with 3 logic layers: 
1. The business layer (Model logic)
2. The display layer (View logic)
3. The input control (Controller logic)
4. The Model is the part of the application that handles.

The View is the parts of the application that handles the display of the data. Most often the views are created from the model data. The Controller is the part of the application that  handles user interaction.Typically controllers read data from a view, control user input, and send input data to the model. The MVC separation helps you manage complex applications, because you can focus on one aspect a time. For example, you can focus on the view without
depending on the business logic. It also makes it easier to test an application. The MVC separation also simplifies group development.
Different developers can work on the view, the
controller logic, and the business logic in parallel.

Web Forms vs MVC
The MVC programming model is a lighter alternative to
traditional ASP.NET (Web Forms). It is a lightweight,
highly testable framework, integrated with all existing
ASP.NET features, such as Master Pages, Security, and Authentication.

Visual Studio Express 2012/2010

Visual Studio Express is a free version of Microsoft Visual Studio.
Visual Studio Express is a development tool tailor made
for MVC (and Web Forms). Visual Studio Express contains:

MVC and Web Forms
Drag-and-drop web controls and web components
A web server language (Razor using VB or C#)
A web server (IIS Express)
A database server (SQL Server Compact)
A full web development framework (ASP.NET)
If you install Visual Studio Express, you will get more benefits from this tutorial.
If you want to install Visual Studio Express, click on one of these links:

Visual Web Developer 2012 (If you have
Windows 7 or Windows 8)

Visual Web Developer 2010 (If you have Windows Vista Or  XP)

Monday 21 April 2014

C# Type casting

Type conversion is basically type casting or
converting one type of data to another type.

In C#, type casting has two forms:

1. Implicit type conversion - these conversions are performed by C# in a type-safe manner.
                      Examples are conversions from
smaller to larger integral types and
conversions from derived classes to base
classes.

2. Explicit type conversion - these conversionsare done explicitly by users using the pre-defined functions. Explicit conversions require a cast operator.

The following example shows an explicit type
conversion:

namespace TypeConversionApplication
{
class ExplicitConversion
{
static void Main(string[] ar
{
double d = 5673.74 ;
int i ;
// cast double to int.
i = ( int ) d;
Console . WriteLine( i );
Console . ReadKey();
}
}
}

When the above code is compiled and executed, it produces the following result:

5673

**C # Type Conversion Methods
C# provides the following built-in type conversion methods:

S.N Methods & Description
1 .ToBoolean
          Converts a type to a Boolean value, where possible.

2. ToByte
          Converts a type to a byte.

3. ToChar
          Converts a type to a single Unicode
character, where possible.

4. ToDateTime
          Converts a type (integer or string type) to date-time structures.

5. ToDecimal
          Converts a floating point or integer type to a decimal type.

6. ToDouble
           Converts a type to a double type.

7. ToInt16
            Converts a type to a 16-bit integer.

8. ToInt32
            Converts a type to a 32-bit integer.

9. ToInt64
            Converts a type to a 64-bit integer.

10. ToSbyte
           Converts a type to a signed byte type.

11. ToSingle
            Converts a type to a small floating point number.

12. ToString
             Converts a type to a string.

13. ToType
             Converts a type to a specified type.

The following example converts various value types to string type:

namespace TypeConversionApplication
{
class StringConversion
{
static void Main(string[] ar
{
int i = 75;
float f = 53.005f ;
double d = 2345.7652 ;
bool b = true;
Console . WriteLine( i . ToSt
Console . WriteLine( f . ToSt
Console . WriteLine( d . ToSt
Console . WriteLine( b . ToSt
Console . ReadKey();
}
}
}

When the above code is compiled and executed, it produces the following result:

75
53.005
2345.7652
True

Compiling and executed a c# program

If you are using Visual Studio.Net for compiling and executing C# programs, take the following steps:
1. Start Visual Studio.

2. On the menu bar, choose File, New, Project.

3. Choose Visual C# from templates, and then  choose Windows.

4. Choose Console Application.

5. Specify a name for your project, and then choose the OK button.

6. The new project appears in Solution Explorer.

7. Write code in the Code Editor.

8. Click the Run button or the F5 key to run the project. A Command Prompt window appears that contain the line Hello World.

You can compile a C# program by using the
command-line instead of the Visual Studio IDE:

* Open a text editor and add the above- mentioned code.

* Save the file as helloworld.cs

* Open the command prompt tool and go to the directory where you saved the file.

* Type csc helloworld.cs and press enter to compile your code.

* If there are no errors in your code, the command prompt will take you to the next line and would generate helloworld.exe executable file.

* Next, type helloworld to execute your program.

* You will be able to see "Hello World" printed on the screen.

Friday 11 April 2014

Data access in ASP.net

ASP.Net allows the following sources of data to be accessed and used:
* Databases (e.g., Access, SQL Server, Oracle, MySQL)
* XML documents
* Business Objects
* Flat files

     
         ASP.Net hides the complex processes of data access and provides much higher level of classes and objects
through which data is accessed easily. These classes hide all complex coding for connection, data retrieving, data querying and data manipulation. ADO.Net is the technology that provides the bridge
between various ASP.Net control objects and the
backend data source. 

          We will come to ADO.Net in due time. In this tutorial, we will look at data access and working with the data without going into the details of its inner workings.


Retrieve and display data :
It takes two types of data controls to retrieve and display data in ASP.Net:

       A data source control . it manages the connection to the data, selection of data and other jobs like paging and caching of data etc. A data view control . it binds and displays the
data and allows data manipulation.
We will discuss the data binding and data source controls in details later. In this section, we will use a SqlDataSource control to access data and a GridView control to display and manipulate data. We will also use an Access database, which has details about .Net books available in the market. Name of our
database is ASPDotNetStepByStep.mdb and we will use the data table DotNetReferences.



The table has the following columns: ID, Title, AuthorFirstName, AuthorLastName, Topic, and
Publisher.


Here is a snapshot of the data table:
Let us directly move to action, take the following steps:

(1) Create a web site and add a SqlDataSourceControl on the web form.

(2) Click on the Configure Data Source Link.


(3) Click on the New Connection button to establish connection with a database.


(4) Once the connection is set up, you may save it for further use. At the next step, you are asked to configure the select statement:


(5) Select the columns and click next to complete the steps. 

             Observe the WHERE, ORDER BY, AND the Advanced. Buttons. These buttons allow you to provide the where clause, order by clause and specify the insert, update and delete commands of SQL respectively. This way, you can manipulate the data.

(6) Add a GridView control on the form. Choose the data source and format the control using AutoFormat option.


(7) After this the formatted GridView control displays the column headings, and the application is ready to run.


(8) Finally Run the application



The content file code:
<%@ Page Language= "C#"
AutoEventWireup = "true"
CodeBehind = "dataaccess.aspx.cs"
Inherits= "datacaching.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1
     "http://www.w3.org/TR/xhtml1/DTD/xhtm
<html xmlns = "http://www.w3.org/1999/xhtml"
<head runat = "server" >
<title> Untitled Page </title>
</head>
<body>
<form id = "form1" runat = "server" >
<div>
<asp:SqlDataSource ID="SqlDataSource1"
   runat="server"
   ConnectionString=
   " <% $ ConnectionStrings : ASPDotNetStepBySt
ProviderName=
" <% $ ConnectionStrings :
ASPDotNetStepByStepConnectionString.
SelectCommand="SELECT [Title], [AuthorLa
[AuthorFirstName], [
FROM [DotNetReferences]">
</asp:SqlDataSource>
<asp:GridView ID = "GridView1"
runat = "server"
AutoGenerateColumns = "False"
CellPadding = "4"
DataSourceID= "SqlDataSource1"
ForeColor = "#333333"
GridLines = "None" >
<RowStyle BackColor = "#F7F6F3" ForeColor = "#
<Columns>
<asp:BoundField DataField = "Title" HeaderTex
SortExpression = "Title" />
<asp:BoundField DataField = "AuthorLastName"
HeaderText = "AuthorLastName"
SortExpression = "AuthorLastName" />
<asp:BoundField DataField = "AuthorFirstName"
HeaderText = "AuthorFirstName"
SortExpression = "AuthorFirstName" />
<asp:BoundField DataField = "Topic"
HeaderText = "Topic" SortExpression = "Topic" /
</Columns>
<FooterStyle BackColor = "#5D7B9D"
Font-Bold = "True" ForeColor = "White" />
<PagerStyle BackColor = "#284775"
ForeColor = "White" HorizontalAlign = "Center"
<SelectedRowStyle BackColor = "#E2DED6"
Font-Bold = "True" ForeColor = "#333333" />
<HeaderStyle BackColor = "#5D7B9D" Font-Bold
ForeColor = "White" />
<EditRowStyle BackColor = "#999999" />
<AlternatingRowStyle BackColor = "White" Fore
</asp:GridView>
</div>
</form>
</body>
</html>

SAP HANA DB ANALYSIS AFTER ISSUES

To be able to further analyze your issue and environment please download the attached shell script you can get from KBA: 3218277 - Collectin...