SQL Server Reporting Service(SSRS) 

Assalamualaykum wr br

I was working with migration of crystal reports to SSRS. There are much differences in these two reporting strategies which I am going to focus here.

1.  Crystal report would have report header and report footer which displayed on whole report. In addition to it page header and footer does have.

2. SSRS would have only page header and footer which will be displayed on every page. SSRS page header and footer works like report header and footer.

3. To have page header in SSRS report we need to perform some actions which are as follows:

Select a column header, at below there is a columns table with drop down click it which shows advance view,click it which displays static headers next to it. Click the static and press f4 key which displays properties of tablix member there at last a property repeat on every page set it to true and select after option.

Working with Hadoop 2.7.3

Assalamualaykum Wr Br..:)

Today we discuss about stuff in hadoop 2.7.3

  1. To Know the version of hadoop installed in your system then user the below command  $ hadoop versionhadoopversion
  2. Start the Hadoop using command $ start-all.sh
  3. Know the status of Java virtual Machine process status from command $ JPS
  4. Create a text file in home directory with command as gedit aejaaz.txt and write some data in it and save then close it.
  5. Now moving this file in hdfs using command $ hdfs dfs -put /aejaaz.txt /inputjps
  6. The Above image shows result of all commands stated above.
  7. Find the count of all words in files using hadoop predefined wordcount mapreduce program. Note: at first type hadoop then type jar then path of   wordcount
  8. Now lets start exploring it in web browser from url http://localhost:50070namenodeThats it for today..!!!  Jazakallah khair

Asp.Net GridView Control 1

Assalamualaykum Wr Br…today we explore the asp.net’s powerful control to display data as in tabular format with built-in Edit, Update, Cancel and Insert options, named as GRIDVIEW. The general syntax of markup is as shown:
<asp:GridView ID=”gridview1″ runat=”server”>
</asp:GridView>

This gridview will not display data because it has not datasource and databind method is called.

 

Pagination in Oracle 11g

Assalamualikum wr br.

Today we discuss about one requirement where data needs to be displayed in GridView from table abc which has more than 2,66,000  records. This was coded to fetch data using DataAdapter on page_load event later it was done pagination from memory using GridView pagination. Later it was reported that memory leakage encountered and pagination is not responding.

Hence it was suggested to retrieve data on demand which means based on page index of gridview, no. of records needs to be fetched from data table.

Also most interesting point is Oracle 11g is being used which does not support Fetch and Limit keywords.

Fetch is used to limit the result set  generated  from the query. Since we use 11g we need to modify the existing query  as below:

Select   *  from

(         Select  p.record_type,

p.reject_reason,

p.dealer_id,

p.dealer,

p.company,

p.country,

p.state,

p.pin,

rownum rm

from

(select   p.record_type,

p.reject_reason,

p.dealer_id,

p.dealer,

p.company,

p.country,

p.state,

p.pin

from  abc) p

where rownum <=   50 <max_limit>)

where rm >= 10  <min_limit>;

 

With the help of above modifications I can able to retrieve the records in table data between max_limit and min_limit. Otherwise the rownum would return from records 1 to specified constraint.

 

That’s all for the day.

Jazakallah khair..Happy Programming..:)

Entity Framework with MVC WebApp.

Assalamualaykum Wr Br..:)
Today we build MVC web app. with Entity Framework. Lets add new table TblEmployee in EF_DBFirst database as shown below:
tblemployee
The respective script is:
CREATE TABLE [dbo].[TblEmployee] (
[Id]     INT          NOT NULL,
[Name]   VARCHAR (50) NOT NULL,
[Gender] VARCHAR (50) NOT NULL,
[City]   VARCHAR (50) NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
Now create new application of MVC_EF and add new controller EmployeeController.cs, Employee.cs in Model, EmployeeContext.cs in Model and Display.cshtml in Views/Employee. As per the table design generate a class with name Employee.cs in Model as shown below:
employee
In above class, Table attribute describes class Employee as per the table TblEmployee and Table attribute exists in System.ComponentModel.DataAnnotations.Schema namespace. Now we need to create connection string which is done in web.config as shown:
connectionstring
Please notice that we have provided name=”EmployeeContext”hence we create a dbcontext class as shown below with name EmployeeContext.cs where we define property which returns whole data of table employee.
employeecontext
Now focus on controller class which is responsible for routing the user requests and response. Design the controller class as shown below:
controller
In controller we create employeecontext class object and access single record with respect to id passed from frontend as a parameter to Details Controller. The Linq query is                                      (emp => emp.Id == id)
emp is temporary variable which cross checks with parameter id with existing db Id, if matches then displays data of record and returns to view. view is designed as shown:
view
the first line of above states that this view accesses model Employee and @Model.Name is retrieved from db table. Finally if i pass the url the following output is seen.

mvc_output

Thats all for the day.Jazakallah Khair.

 

What is Entity Framework..?

Assalamualaykum wr br..:
Today we discuss what EF is..?
EF is ORM framework. ORM -> Object Relational Mapping. ORM automatically creates classes based on Database tables, and vice versa is also true. ie. it can also automatically generate SQL to create database tables based on classes.
Lets start a small project on it to understand better. To achieve it,
1. Create Department and Employee Classes.
2. Write ADO.Net code to retrieve data from the database.
3. Need to create objects of Department and classes to populate data.
Entity Framework can do all the above statements automatically , if we provide it with database shema.
Create the Database and tables as shown below:
dbscripts
Now add the Ado.net Entity Data Model and name it as EmployeeModel.edmx file and this results in wizard, supply the necessary values and finish.
Connectionstring.png
compile the solution and add new webform in which add gridveiw and entity datasource control and then configure the Entity datasource with database and tables of employee and department and allow it to generate from database.
Thats it for the day..also  please have a look on the versions of EF.
The following table lists all the important versions of Entity Framework.

EF Version Introduced Features
EF 3.5 Basic O/RM support with Database First approach.
EF 4.0 POCO Support, Lazy loading, testability improvements, customizable code generation and the Model First approach.
EF 4.1 First to available in the NuGet, Simplified DBContext API over ObjectContext, Code First approach. EF 4.1.1 patch released with bug fixing of 4.1.
EF 4.3 Code First Migrations feature that allows a database created by Code First to be incrementally changed as your Code First model evolves. EF 4.3.1 patch released with bug fixing of EF 4.3.
EF 5.0 Announced EF as Open Source. Introduced Enum support, table-valued functions, spatial data types, multiple-diagrams per model, coloring of shapes on the design surface and batch import of stored procedures, EF Power Tools and various performance improvements.
EF 6.0 – Current release EF 6.0/6.1 is the latest release of Entity Framework. It includes many new features related to Code First & EF designer like asynchronous query & save, connection Resiliency, dependency resolution etc.

Entity Framework Webapp

Assalamualaykum wr br..:)
Today we are discuss about the code first approach of EF where code is designed based on which database is generated with tables and keys.
Lets quick start with web application. Create New Project -> WebSite -> <NameApp>.
Create the two classes in separate files Employee and Department also add two more classes with names as EmployeeDBContext.cs and EmployeeRepository.cs as shown
solution

Code the Employee class as shown below. Every Employee is associated with Department hence it is defined using Department property whose return type is Department and as it is available in both tables(Classes) hence it is referenced as Navigation Properties and remaining properties like Id, Firstname,  secondname etc are Static Properties.
employee
Now code the Department class as below. Every Department have Id, Name which will be Static Properties and each department holds multiple employees for which list is considered with return type as employee which is navigation properties.

department

Now lets create EmployeeDBContext.cs class where we create datasets of tables to populate the data as applicable.
employeedbcontext

To fetch and operate on tables data we need to have one generic class which is referred to as EmployeeRepository.cs as shown below. It has one Get method which populates the department class data and returns.
employeerepository
Finally add new Webform.aspx and drag and drop grid view control and also datasource control as shown below. Before you add webform compile your project to let EF create dlls which is used to reference in datasource control. In above image of employeerepository class we see Include(“Employees”). This Include method used to display Navigation Properties where in Department table Employees is the Navigation Property.
webform
Thats it for the Day..:)    Jazakallah khair