Monday, October 29, 2012

LINQ Sample

There are three parts in any LINQ Query
a. Data Source  - Could be an array collection, Database TAble, Object Collection, Etc...
b. Creating Query - The LINQ Query Creation
c. Executing Query - Query created doesn't get executed immedietly. It gets executed only during enumeraing the result


class SampleLINQ
    static void Main()

        //  1. Getting Data source.
        int[] intarray = new int[5] { 3, 1, 9, 63, 17};

        // 2. Query creation.
        var intenumQuery =
            from num in intarray
            where (num % 3) == 0
            select num;

        // 3. Query execution.
        foreach (int intvalue in intenumQuery )
            Console.Write("{0,1} ", num);

Wednesday, October 24, 2012

Getting HTML from aspx page and save to file

This post gives the sample code to download the html of an aspx and save in to a file

Add reference to System.Net. namespace.

protected void Download_Click(object sender, EventArgs e)
         WebClient mydwdClient = new WebClient();
         string currentUrl = Request.Url.ToString(); // The page which needs to be downloaded
         string webpageinHTML = String.Empty;
         byte[] bytHTML;
        UTF8Encoding utfenc= new UTF8Encoding();       
         bytHTML = mydwdClient.DownloadData(currentUrl );
        webpageinHTML = utfenc.GetString(bytHTML);         
         Response.Write(webpageinHTML );                   

Another method which i found in forum is

protected override void Render(HtmlTextWriter writer)
StringBuilder sbOut = new StringBuilder();
StringWriter swOut = new StringWriter(sbOut);
HtmlTextWriter htwOut = new HtmlTextWriter(swOut);
string sOut = sbOut.ToString();

// Send sOut as an Email


Saturday, September 15, 2012

Interview Questions

Here are some of the interview questions:
It is mixture of, C#, Vb.Net, OOPS, WebServices, WCF, SQL Server, SSRS, SSIS

a. What is the architecture of Ajax in (How it actually works)
b. How a page is processed
c. How to debug application, SQL Query
d. How to find the Stored Procedures property (what command)
e. DBCC - What for it is used
f. How to take and restore SQL Server Backup
g. How to find SQL Server property
h. What are page members and methods
i. How to deploy a SSRS report
j. What is delegate
k. What is the difference between delegate and Event
l. How to create cookies
m. What is WCF
n. Difference between WCF and Web Services
o. What is inner exception
p. What is IDisposable Interface
q. What is IEnumerable Interface

.......Will Keep Adding