Search This Blog

Loading...

Feb 24, 2011

How to create XML File in .net

In .net we can create XML file from three different places
  • By Using XMLWriter
  • By Using XMLTextWriter
  • By Saving a Dataset as XML Data
Why We Need Data in XML Format
Consider an example. ABC is a leading London based courier company and having branches across the UK. At the year end the head office needs the details from each offices of the various transactions. However different branch offices are working on different platform. Here XML will come into picture.

Feb 22, 2011

Array Tutorial: How to find a highest value in a array

How to Find a Highest Number of element in Array:  In C# finding a highest number of element in array is very easy, with the help of Reverse method it becomes more easier.  
 
ArrayList arrList = new ArrayList();
arrList.Add(3);
arrList.Add(7);
arrList.Add(5);
arrList.Add(10);
arrList.Add(2);
arrList.Add(1);
arrList.Add(6);
arrList.Sort();
arrList.Reverse(); 
 
int nHighestVal = int.Parse(arrList[0].ToString());
MessageBox.Show("Highest Value is " + nHighestVal);
 
 
That's it, hope this is helpful for you.
Related Link : 

Feb 21, 2011

What is MVVM

In my own learning i learn how to use MVC approach in web based application because i am a web developer for years. MVC is a mixed designed patterns it made up of other design patterns. It is an well established pattern specially for .net applications. It having different versions as well like MVC, MVP, MVVM here i am going to focus on MVVM model.

MVVM: It is just like a container and almost similar to MVC, here the controller is replaced with a View Model which sits just below the UI Layer. If you are working on WPF then it is good to have MVVM because it helps you to get the most out of WPF.

Main benefit of the viewmodel pattern which i understand is to remove code from XAML code behind to make XAML a more independent work.
The view model communicates with the model (business logic, services whatever below it).the view does not need to know about any else in your architecture. It provides commands which allow the view to manipulate the model.

MVVM is developed when Microsoft team's developing expression blend.MVVM is attractive for platforms which support bi-directional binding with less effort.

Feb 14, 2011

Indexof Function


[C#]

using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
namespace MyApp
{
    class Program
    {
        static void Main(string[] args)
        {
        string string1 = ''Best Coding Practice by - Microsoft";
        string string2 = "MICROSOFT";
        CompareInfo myCompare = CultureInfo.InvariantCulture.CompareInfo;
        int Pos = myCompare.IndexOf(string1, string2, CompareOptions.IgnoreCase);
        Console.WriteLine("String Found at: " + Pos);
        Console.ReadLine();
        }
    }
}

It will return the position of string 2.

Feb 9, 2011

How to create Relationship in a DataTable

In Ado.net, A DataSet.Relations property gets the collection of relationtions thank link tables with the help of Keys (Primary&Foreign Key).

With the help of Keys we can create the relationship with the mulitple tables and navigate through mulitple tables. The table that has Primary key constraints is known as Primary key and other table known as Child table.

Consider the following example.
DataSet ds = new DataSet();
// Add Table in the DataSet
DataTable dt = ds.Tables.Add("Product");
// Add Columns
dt.Columns.Add("Product ID", typeof(string));
// Add another table(store) in the DataSet
DataTable dt1 = ds.Tables.Add("Store");
// Add Coloumns
dt1.Columns.Add("Product ID", typeof(string));
dt1.Columns.Add("StoreID", typeof(string));
 // Primary key initialization
 dt.PrimaryKey = new DataColumn[]{dt.Columns["Product ID"]};
 // Establish the relationship
  ds.Relations.Add("Details",dt1.Columns["Product ID"],
  dt.Columns["Product ID"]);


 *Here Details is the name of the relations that is responsible to establish the relationship between tables.

How to add columns in a DataTable

Consider the following code snippet

// Create a dataset object
DataSet ds = new DataSet();
// Cteate a DataTable object
DataTable dt = new DataTable();
dt = dt.Tables.Add();
 // Add columns in a Data Table
dt.Columns.Add("col name",typeof(string));


Feb 5, 2011

Sr. Dot Net Professional Required

Technology : Dot Net
Work Location : Gurgaon
Client : CMMi 3 Level Organization

Job Description:

  • Strong knowledge in dot net
  • Experience in multithreaded programming
  • Experience in WCF, Web services
  • Good documentation skills
  • Unit testing
  • Test driven development

Contact Person

Naveen Silswal
0120-4230418
Account Manager
Apricot Consulting

Feb 4, 2011

SQL Server Interview Questions

 

  • What is Join(Left, Right, Full)
  • Difference between Unique and Unique All in SQL Server
  • Can we have more than 1 Cluster Index in Any version of SQL Server?
  • Can we use Trigger with Truncate command?
  • Can we user transactions in Triggers?
  • What is Normalization
  • What is difference between Not in & Minus Clause
  • Can we use multiple table in from clause with Update statement  in SQL Server and Oracle.
  • When to use Exist clause in SQL

*for 3-4 Years of Experience

Follow by Email