Infolink

 

Search This Blog

Showing posts with label examples. Show all posts
Showing posts with label examples. Show all posts

Mar 21, 2014

List of FUNCTIONS in Crystal Report

Crystal Reports provides many FUNCTIONS for extracting information from the files. 

List of Functions

  • Abs(x)
  • Average([array])
  • Average(field, condField)
  • Average(field, condField, "condition")
  • Average(field)
  • BeforeReadingRecords
  • Count([array])
  • Count(field, condField)
  • Count(field, condField, "condition")
  • Count(field)
  • Date (yyyy, mm, dd)
  • Day (x)
  • DayOfWeek (x)
  • GroupNumber
  • IsNull
  • Length(x)
  • LowerCase (x)
  • Maximum([array]) Maximum(field, condField)
  • Maximum(field, condField, "condition")
  • Maximum(field)
  • Minimum([array])
  • Minimum(field, condField)
  • Minimum(field, condField, "condition")
  • Minimum(field)
  • Month (x)
  • Next
  • NextIsNull
  • NumericText(fieldname)
  • PageNumber
  • PopulationStdDev([array])
  • PopulationStdDev(field, condField)
  • PopulationStdDev(field, condField, "condition")
  • PopulationStdDev(field)
  • PopulationVariance([array])
  • PopulationVariance(field, condField)
  • PopulationVariance(field, condField, "condition")
  • PopulationVariance(field)
  • Previous
  • PreviousIsNull
  • PrintDate
  • RecordNumber
  • Remainder(numerator, denominator)
  • ReplicateString(x,n)
  • Round(x, # places)
  • Round(x)
  • StdDev([array])
  • StdDev(field, condField)
  • StdDev(field, condField, "condition")
  • StdDev(field)
  • Sum([array])
  • Sum(field, condField)
  • Sum(field, condField, "condition")
  • Sum(field)
  • Today
  • ToNumber (x)
  • ToText (x, # places)
  • ToText (x)
  • ToWords(x, # places)
  • ToWords(x)
  • TrimLeft (x)
  • TrimRight (x)
  • Truncate (x)
  • UpperCase (x)
  • Variance([array])
  • Variance(field, condField)
  • Variance(field, condField, "condition")
  • Variance(field)
  • WhilePrintingRecords
  • WhileReadingRecords
  • Year (x)

Nov 25, 2012

Popup window

Here I am going make custom model popup with using JQuery. Its looks very Attractive rather than the simple alert box in Asp.Net.

In my application, i would like to use the popup window concept. When the user clciks a button, a popup window should appear, with a textbox to enter a value. on closing the popup window, the user entered value should get saved into a table.

Nov 24, 2012

decimal and numeric (Transact-SQL)

Decimal and numeric

Numeric data types that have fixed precision and scale.

decimal [ (p[ ,s] )] and numeric[ (p[ ,s] )]
  • Fixed precision and scale numbers. When maximum precision is used, valid values are from - 10^38 +1 through 10^38 - 1. The ISO synonyms for decimal are dec and dec(p, s). numeric is functionally equivalent to decimal.
  • p (precision)
  • The maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point. The precision must be a value from 1 through the maximum precision of 38. The default precision is 18.
  • s (scale)
  • The maximum number of decimal digits that can be stored to the right of the decimal point. Scale must be a value from 0 through p. Scale can be specified only if precision is specified. The default scale is 0; therefore, 0 <= s <= p. Maximum storage sizes vary, based on the precision.
Precision Storage bytes

1 - 9       5

10-19     9

20-28    13

29-38    17

As per my understanding NUMERIC(18, 10) column would take 18 decimal digits to the left of the decimal point and 10 to the right.

Example:

SELECT CAST(1234567891234567.34 AS NUMERIC(18,2))  --Works
SELECT CAST(1234567891234567.34 AS NUMERIC(18,10)) --fails with Arithmetic overflow error


it is clear that, in the first case from the statement NUMERIC(18,2) the total digits are 18 and 16 digits are available to the left of decimal, whereas 1234567891234567 are 16 digits. Hence, there is no error.
In the second case, from the statement NUMERIC(18,10), 8 digits are available to the left of decimal, but 1234567891234567 are 16 digits which is more than 8 digits. Hence, Arithmetic overflow error occurs.

Nov 18, 2012

MVC Tutorial (PART-1)

The Model

Models are the main component of your app, which is usually; what is stored and retrieve from the database, in our app, it will the tweet info and text.

The View

Views are the date in formatted form, delivered to the user. Here it will be the HTML pages.

The Controller

Controllers are the components that respond to all user requests, decide the appropriate response; which might be render a view, redirect to other URI or many other things.

Pros and Cons
 
Pros

It has many pros, but these are the most remarkable:
  • Full control over the HTML, CSS, and JavaScript code, helping you to write clean, standards-compliant markup
  • It's Extensible which means that you can use a default component, or reconfigure it, or even use another component
  • HTTP friendly, it gives you total control over the requests passing between browser and server
  • Testability of MVC makes it simple to unit test the logic that is specific to a page, by testing controller methods
Cons 

It does not really have many cons compared to its pros:
  • The lake of drag and drop component in WebForms, despite that JQuery and other JavaScipt library overcome this problem
  • It's not as easy as WebForms, you should understand the role of each component individually and all of them together.

Nov 11, 2012

.Net C# How to dynamically add controls to a form

Dynamically Adding Controls to a Windows Form

I have a project right now who’s requirements are to dynamically create sections on a form, dynamically create items in those sections (checkboxes, text boxes, etc), and store the values entered in those boxes in a database.

Now this is no small task, but it had me thinking. It’s been a while since I wrote something that used dynamic controls. Since I’m writing the code anyway I thought I would share the technical details as to how you too can create your own controls on the fly, and hook up the events, and read the data. So many web demo’s seem to show the first and miss the next two (which would be the same as missing the point entirely..)

Nov 10, 2012

Create Html Table Dynamically

The following code dynamically creates a table with five rows and four cells per
row, sets their colors and text, and shows all this on the page. The interesting detail is that no control tags are declared in the .aspx file. Instead, everything is generated programmatically.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class DynamicTable : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlTable table1 = new HtmlTable();

        // Set the table's formatting-related properties.
        table1.Border = 1;
        table1.CellPadding = 0;
        table1.CellSpacing = 0;
        table1.BorderColor = "red";

        // Start adding content to the table.
        HtmlTableRow row;
        HtmlTableCell cell;
        for (int i = 1; i <= 3; i++)
        {
            // Create a new row and set its background color.
            row = new HtmlTableRow();
            row.BgColor = (i % 2 == 0 ? "lightgreen" : "lightgray");
            for (int j = 1; j <= 5; j++)
            {
                // Create a cell and set its text.
                cell = new HtmlTableCell();
                cell.InnerHtml = "Row: " + i.ToString() + "<br />Cell: " + j.ToString();
                // Add the cell to the current row.
                row.Cells.Add(cell);
            }

            // Add the row to the table.
            table1.Rows.Add(row);
        }

        // Add the table to the page.
        this.Controls.Add(table1);
    }
}

UpdateProgress in Asp.Net

One of the problems with Ajax, is the fact that since it's asynchronus and in the background, the browser will not show you any status. With fast servers and fast methods, this is not a big problem, but whenever you have a method which takes up a bit of time, the user is very likely to get impatient.

Fortunately, ASP.NET AJAX solves this problem for us as well, with a nice control called UpdateProgress. It will use your own template to show that an asynchronus method is working. Have a look at the following example, which will show the control in action. It will be explained afterwards.

Nov 8, 2012

IList Generic Interface

IList Generic Interface represents a collection of objects that can be individually accessed by index.

This example demonstrates how to use IList Generic Interface to store data.
IList Generic Interface represents a collection of objects that can be individually accessed by index.
First, you will need to import the System.Collections.Generic namespace.
using System.Collections.Generic;

MenuStrip in C#

The MenuStrip class is the foundation of menus functionality in Windows Forms. If you have worked with menus in .NET 1.0 and 2.0, you must be familiar with the MainMenu control. In .NET 3.5 and 4.0, the MainMenu control is replaced with the MenuStrip control.

Creating a MenuStrip

We can create a MenuStrip control using a Forms designer at design-time or using the MenuStrip class in code at run-time or dynamically.

To create a MenuStrip control at design-time, you simply drag and drop a MenuStrip control from Toolbox to a Form in Visual Studio. After you drag and drop a MenuStrip on a Form, the MenuStrip1 is added to the Form and looks like Figure 1. Once a MenuStrip is on the Form, you can add menu items and set its properties and events.

Basic differences between Oracle and SQL Server

most obvious differences are:

  • The FIRST biggest difference: Transaction control. In Oracle EVERYTHING is a transaction and it is not permanent until you COMMIT. In SQL Server, there is (by default) no transaction control. An error half way through a stored procedure WILL NOT ROLLBACK the DDL in previous steps.

Obviously, if you wrap the TSQL DML in BEGIN TRANSACTION and COMMIT then it will roll back but this is rare in SQL Server code I've seen.

  • The SECOND biggest difference: MVCC. In SQL Server and Oracle is different. SQL Server will allow dirty reads, and writes can block reads in MS SQL (Again, it's configurable but the default in SQL Server is for performance and not read consistency, unlike Oracle where read consistency is default and unbendable.

Also consider:

  • When you setup an Oracle server, you tend to have one database with many "users/schemas", and tablespaces that are shared by all your users. SQL Server has separate databases that do not share disk files.
  • SQL Server uses "logins" to give you access to the SQL Server instance and each database has "users" that map to a login to get individual access to the tables and views etc.
  • Typically, all the objects in a database are owned by dbo.
  • TSQL is similar to PL/SQL, but (in my opinion) less powerful. You may need to simplify your SQL to get it to work as well as you'd expect in Oracle.
  • The SQL Server Management Studio (2008 SP1) is fantastic!
  • If you like Oracle, all the "getting under the hood" and "explain plan optimisation" then this training and experience will work well for you against guy's who just code straight SQL Server TSQL and expect the server to perform fast by magic.
  • SQL Server does not have packages. This might start off as a bonus (PL/SQL packages can be a PITA) but eventually you'll start to get a big nest of similarly named stored procedures in the database and you'll wish there was a way you could organise and group then them better.

Dynamically populate drop-down that is part of form array

I will show you the HTML code, this code consist of two dropdownlist / combo box (two <select> element) with the second <select> element disabled and will be enabled if we choose something from the first <select> element. Here the HTML code (dnmddl.htm):

Nov 7, 2012

DockPanel in Silverlight

If you have used docking Windows in previous versions of .NET, the DockPanel is used to provide that functionality in WPF and Silverlight. The DockPanel is not a part of Silverlight 2. It is a part of Silverlight Toolkit but I am sure it will be a part of the next version of Silverlight.

The DockPanel control is a layout control that acts as a container for child controls. The DockPanel allows child controls to dock in left, right, top, or bottom sides of the panel.

Introduction to Styles in WPF

Introduction

First of all you have to create a new WPF  Project  for that you can do as following.



Nov 5, 2012

StatusBar in c# Windows Application

StatusBar Example

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace StatusBarExample
{
  /// <summary>
  /// Summary description for StatusBarExample.
  /// </summary>
  public class StatusBarExample : System.Windows.Forms.Form
  {
    internal System.Windows.Forms.StatusBar statusBar;
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.Container components = null;

    public StatusBarExample()
    {
      //
      // Required for Windows Form Designer support
      //
      InitializeComponent();

      //
      // TODO: Add any constructor code after InitializeComponent call
      //
    }

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    protected override void Dispose( bool disposing )
    {
      if( disposing )
      {
        if (components != null)
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

    #region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      this.statusBar = new System.Windows.Forms.StatusBar();
      this.SuspendLayout();
      //
      // statusBar
      //
      this.statusBar.Location = new System.Drawing.Point(0, 138);
      this.statusBar.Name = "statusBar";
      this.statusBar.ShowPanels = true;
      this.statusBar.Size = new System.Drawing.Size(292, 24);
      this.statusBar.SizingGrip = false;
      this.statusBar.TabIndex = 1;
      //
      // StatusBarExample
      //
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
      this.ClientSize = new System.Drawing.Size(292, 162);
      this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                      this.statusBar});
      this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
      this.Name = "StatusBarExample";
      this.Text = "StatusBar Example";
      this.Load += new System.EventHandler(this.StatusBarExample_Load);
      this.ResumeLayout(false);

    }
    #endregion

    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
      Application.Run(new StatusBarExample());
    }

    private void StatusBarExample_Load(object sender, System.EventArgs e)
    {
      StatusBarPanel pnlStatus = new StatusBarPanel();
      pnlStatus.Text = "Ready";
      pnlStatus.Icon = new Icon(Application.StartupPath + "\\active.ico");
      pnlStatus.AutoSize = StatusBarPanelAutoSize.Contents;

      StatusBarPanel pnlConnection = new StatusBarPanel();
      pnlConnection.Text = "Connected to " + "localhost";
      pnlConnection.AutoSize = StatusBarPanelAutoSize.Spring;

      statusBar.Panels.Add(pnlStatus);
      statusBar.Panels.Add(pnlConnection);

    }
  }
}

Related Posts Plugin for WordPress, Blogger...