Search 
Friday, May 16, 2008..:: HowTo.NET::..Register  Login
 This page is point outs the problems I’ve faced (Some of them are also asked in ASP.NET C#.NET ADO.NET interviews. So you can count on them as .NET interview questions)
Whenever I find the solutions, I will post them here under each specific problem.
If you don’t see the answer to the problem, and if you know the solutions, please post your solution to me (sevket01@sevder.com) and I will gladly add your solution here under your name.
:)
Happy problem solving


 Popular interview questions & answers
  1. What is the difference between an abstract class and interface?
    i.  Basically you can inherit from 1 abstract class where you can inherit from many interfaces.
    ii. You can have implementations of methods(not abstract methods) inside the abstract class which you may or may not override(or implement in the inherited class). However you have to implement all methods defined in the interface.

    Last post by [Sevket Seyalioglu] on Dec 25, 2004

  2. What is strongly typed datasets and How to use them
    Very basically, at a rookie level Strongly typed datasets are *.xsd files that holds the schema of the data tables that you use in your code behind pages.

    Now, let me directly go into the generation of typed-datasets. (Example is from VS.NET 2003)
    1. Right click on the project folder and click add an item.
    2. Select dataset and type in your desired name. In my exaple "dsReports".

    In the new xsd file, you can drag and drop tables from Server explorer. (Typed datasets also support, views and stored procedures)
    You can also define new tables(elements) of your own to be used only in your code that does not exists in database.

    After setting up your tables in your dataset, it is time to move into code-behind.

    Start by defining your dataset.

    protected dsReports m_ds = new dsReports();

    Then in your methods, you will need to use the datatables defined in your dataset.
    Here is a nice example.

    dsReports.f_mar_analysisDataTable dtAnalysis = m_ds.f_mar_analysis;
    dsReports.f_mar_analysis_datesDataTable dtDate = m_ds.f_mar_analysis_dates;

    //At this point I am assuming you know how to genarate the dataadapter.

    dataAdapObj.Fill(dtAnalysis);

    //Note that, you can also add data to your datatable row by row like in the following example.

    dsReports.f_mar_analysis_datesRow dateRow = datesDt.Newf_mar_analysis_datesRow();
    dateRow.a_dep_date = depDate;
    dateRow.a_total_revenue = 0;
    datesDt.Rows.Add(dateRow);
    datesDt.AcceptChanges();

    //However, as far as I know there is no way to cast a regular datatable into a datatable of typed dataset. The most you will get isnull.

    As you see from the above examples, typed datasets provide
    1. Intelli-sense for
        a. datatables
        b. dataColumns
        c. dataColumnNames
    //not mentioned above
        So no need to memorize any table name or column names.
    2. Datatype check during compile time, not during run-time. As a result, it will pre-check possible errors (type and casting errors) that may arise long before you receive the complains from customers.

    Last post by [Sevket Seyalioglu] on Aug 11, 2004.


  3. Installing//Developing/Using MS Sharepoint Portal 2003
  4. How to write a simple web service? (Hello world)
    Well this one is really simple.
    First create new service file (*.asmx) and by default at the bottom of the page you will see that Microsoft already provided a simple hello world example (assuming that you work with VS.NET 2003).

    However if you don’t use VS.NET 2003, then in this file simply put [WebMethod] as an attribute to your method (from now on it is your web method  )

    Last post by [Sevket Seyalioglu] on Oct 28, 2004.
  5. What is N-tier development? Important points about N-tier.
    The most basic explanation will be hacing more than 1 project in a solution. However these projects are referensed in a logical manner to each other.  And each project stands there for a reason.
    And these projects are actually the layers of the application.
    Each layer can be on the same server or for several different reasons, running on different servers.

    Most common layers are: Data Layer (DAL), Businness Logic Layer (BLL), Web Layer (main web application or other kinds of applications), Model Layer, Utility Layer, Interface Data Access Layer (IDAL:Generally when using more than 1 database types like Oracle & SQL),

    As an example you can see the most basic solution in MS Petshop application.You can download it free from Microsoft.com

    Last post by [Sevket Seyalioglu] on Sep 10, 2004.
  6. Using XSLT. Do you really need to use XSLT.
    5 XSLT basics: http://www.xml.com/pub/a/2003/11/26/learnXSLT.html

    Last post by [Sevket Seyalioglu] on Aug 9, 2004.
  7. What is UML? UML tools. UML techniques.
    UML is basically a visual system workflow diagram. This is the OO degin of the application. .
    A simple UML can be the workflow of a class and the methods, properties inside it.

    You can use MS Visio for UML designs.

    Last post by [Sevket Seyalioglu]

  8. What is secured ASP.NET and how to work with it?
  9. How does ADO.NET handles connection pooling?
  10. What are HTTP Handlers? How do we work with it and how do we assing values to them?
  11. How to handle transactions in ASP.NET using C#.NET? (begin transaction, commit transaction, rollback)
    Answer: There is an object called SqlTransaction. This does handle commit and rollback.
    E.g. (from MSDN)
    [C#]
    publicvoid RunSqlTransaction(string myConnString)
    {
    SqlConnection myConnection = new SqlConnection(myConnString);
    myConnection.Open();
    SqlCommand myCommand = myConnection.CreateCommand();
    SqlTransaction myTrans;

    // Start a local transaction
    myTrans = myConnection.BeginTransaction("SampleTransaction");
    // Must assign both transaction object and connection
    // to Command object for a pending local transaction

    myCommand.Connection = myConnection;
    myCommand.Transaction = myTrans;
    try
    {
    myCommand.CommandText =
    "Insert into Region (RegionID, "
    + "RegionDescription) VALUES (100, ’Description’)";
    myCommand.ExecuteNonQuery();
    myCommand.CommandText =
    "Insert into Region (RegionID, "
    + "RegionDescription) VALUES (101, ’Description’)";
    myCommand.ExecuteNonQuery();
    myTrans.Commit();



    Console.WriteLine("Both records are written to database.");
    }
    catch(Exception e)
    {
    try
    {
    myTrans.Rollback("SampleTransaction");
    }
    catch (SqlException ex)
    {
    if (myTrans.Connection != null)
    {
    Console.WriteLine("An exception of type " + ex.GetType() +
    + " was encountered while attempting to "
    + "roll back the transaction.");
    }
    }
    Console.WriteLine("An exception of type " + e.GetType() +
    " was encountered while inserting the data.");
    Console.WriteLine("Neither record was written to database.");
    }
    finally
    {
    myConnection.Close();
    }
    }

    Last post by [Sevket Seyalioglu] on Aug 3, 2004.
  12. How to swap values of 2 integer variables without using any third variable? (A=20, B=10)
  13. How to write TableCell text from top to bottom mode (90 degrees)?
    You should use writing-mode: tb-rl; andfilter: flipv fliph; in the elements style attribute.

    You can use these from C#.NET Code behind as:
    TableRow tr = new TableRow();
    TableCell tc = new TableCell();
    tc.Text = "SOME TEXT";
    tc.Style.Add("writing-mode","tb-rl");
    tc.Style.Add("filter","flipv fliph");
    tc.Wrap = false;
    tr.Cells.Add(tc);
    There is a really good article that explains this case.
    From this article you can learn how to use writing-mode.
    Please see this article at http://www.ssi-developer.net/css/vertical-text.shtml
    Also, if you need more flexibility, it worths to check W3C standards from http://www.w3.org/TR/2003/CR-css3-text-20030514/

    Last post by [Sevket Seyalioglu] on Aug 5, 2004.
  14. How to make TableRow or TableColumn Floating? (Like freeze panes in Excel?
  15. How can you test your application programatically?
  16. How can you open Asynchronous connection and select data into your DataTables?
  17. How to set data column to NULL from Sql Server Enterprise Manager Result Set?
    Solution is simple. Basically hit ctrl + 0 and the column will be NULL when you move out from it.

    Last post by [Sevket Seyalioglu] on Aug 10, 2004.
  18. How to create custom sections in web.config and how to read this information?
    Please visit the following links:
    1. Declaring and Accessing Custom Configuration Sections
    2. Configuration Sections Schema (Read #1 first, then move to this article)
    3. MSDNMag article: What’s in ASP.NET Config Files? (I strongly recommend this one)
    Last post by [Sevket Seyalioglu] on Oct 24, 2004.
  19. How do I print only what every I want to be printed without having an additional page? (How do I print portions of the page?)
    There is such a nice and neat solution that works for all browsers (well I tested it with Firefox and internet explorer).
    First put the following code inside your HTML(preferably between head tags). (In dotNetNuke, the best place is your skin file)

    <style type="text/css"media="print">
    .dontprint { visibility: hidden; display: none }
    style>

    And then, in your HTML code, just assign this class "dontprint" to the tags, that you don't want to print. It is that simple.

    Example tag:
      <tr class="dontprint">
        <td height="17"colspan="3"><img src="Portals/0/Skins/LowFareNow/bottom_banner.jpg"width="765"height="17">td>
      tr>

    When you do this, your page will display properlyand only when you want to print these items that you don't want to be printed, will not be printed but the rest. I find this very neat and handy as it saves your valuable time with 2-3 keystrokes onlywithout extra coding.


Syndicate   Print   
www.Sevder.com provides tips and techniques for asp.net, csharp, sql, stored procedures to developers from developer.
Copyright 2004-2005 SevDer.com   Terms Of Use  Privacy Statement