CSV File To DataTable .Net C#


string CSVFilePathName = @"C:\test.csv";
string[] Lines = File.ReadAllLines(CSVFilePathName);
string[] Fields;
Fields = Lines[0].Split(new char[] { ',' });
int Cols = Fields.GetLength(0);
DataTable dt = new DataTable();
//1st row must be column names; force lower case to ensure matching later on.
for (int i = 0; i < Cols; i++)
    dt.Columns.Add(Fields[i].ToLower(), typeof(string));
DataRow Row;
for (int i = 1; i < Lines.GetLength(0); i++)
{
    Fields = Lines[i].Split(new char[] { ',' });
    Row = dt.NewRow();
    for (int f = 0; f < Cols; f++)
        Row[f] = Fields[f];
    dt.Rows.Add(Row);
}

Simple Interview Question Answer !!!!!


Tough question No. 1: “Tell me about yourself.”

This is usually the opening question in an interview and it’s the perfect moment for you to toot your own horn — not to tell your life history. Your answers should be a quick rundown of your qualifications and experience. Talk about your education, work history, recent career experience and future goals.

Suggested answer: “I graduated from University X and since then, I have been working in public relations with an agency where I have generated millions of PR hits for my clients. While I’ve enjoyed working on the agency side, I’m looking to expand my horizons and start doing PR for corporate companies such as this one.”

Tough question No. 2: “Why did you leave your last job?”

This is your chance to talk about your experience and your career goals, not to badmouth a former boss or give a laundry list of reasons for your exit. Instead, focus on what you learned in your previous position and how you are ready to use those skills in a new position.

Suggested answer: “The company just wasn’t a good fit for my creativity, but I learned that organizations have distinct personalities just like people do. Now I know where I’ll be a better fit.”

Tough question No. 3: “Where do you see yourself in five years?”

Let the employer know that you’re stable and you want to be with this company for the long haul. Keep your aspirations to take over the firm with which you are interviewing, own your own company, retire at 40 or be married with five children to yourself.

Suggested answer:  “I want to secure a civil engineering position with a national firm that concentrates on retail development. Ideally, I would like to work for a young company, such as this one, so I can get in on the ground floor and take advantage of all the opportunities a growing firm has to offer.”

Tough question No. 4: “What are your weaknesses?”

The key to answering this age-old question is not to respond literally. Your future employer most likely won’t care if your weak spot is that you can’t cook, nor do they want to hear the generic responses, like you’re “too detail oriented” or “work too hard.” Respond to this query by identifying areas in your work where you can improve and figure out how they can be assets to a future employer. If you didn’t have the opportunity to develop certain skills at your previous job, explain how eager you are to gain that skill in a new position.

Suggested answer: “In my last position, I wasn’t able to develop my public-speaking skills. I’d really like to be able to work in a place that will help me get better at giving presentations and talking in front of others.”

Tough question No. 5: “Why were you laid off?”

This question will become more common as the economy continues to slow down. It’s a tough question, however, especially because many workers aren’t told exactly why they were laid off. The best way to tackle this question is to answer as honestly as possible.

Suggested answer: “As I’m sure you’re aware, the economy is tough right now and my company felt the effects of it. I was part of a large staff reduction and that’s really all I know. I am confident, however, that it had nothing to do with my job performance, as exemplified by my accomplishments. For example…”

Tough question No. 6: “Tell me about the worst boss you ever had.”

Never, ever talk badly about your past bosses. A potential boss will anticipate that you’ll talk about him or her in the same manner somewhere down the line.

Suggested answer: “While none of my past bosses were awful, there are some who taught me more than others did. I’ve definitely learned what types of management styles I work with the best.”

Tough question No. 7: How would others describe you?

You should always be asking for feedback from your colleagues and supervisors in order to gauge your performance; this way, you can honestly answer the question based on their comments. Keep track of the feedback to be able to give to an employer, if asked. Doing so will also help you identify strengths and weaknesses.
Suggested answer: “My former colleagues have said that I’m easy to do business with and that I always hit the ground running with new projects. I have more specific feedback with me, if you’d like to take a look at it.”

Tough question No. 8: “What can you offer me that another person can’t?”

This is when you talk about your record of getting things done. Go into specifics from your résumé and portfolio; show an employer your value and how you’d be an asset.

Suggested answer: “I’m the best person for the job. I know there are other candidates who could fill this position, but my passion for excellence sets me apart from the pack. I am committed to always producing the best results. For example…”

Tough question No. 9: “If you could choose any company to work for, where would you go?”  

Never say that you would choose any company other than the one where you are interviewing. Talk about the job and the company for which you are being interviewed.

Suggested answer: “I wouldn’t have applied for this position if I didn’t sincerely want to work with your organization.” Continue with specific examples of why you respect the company with which you are interviewing and why you’ll be a good fit.

Tough question No. 10: “Would you be willing to take a salary cut?”

Salary is a delicate topic. In today’s tough economy though, how much a company can afford to pay you might be the deal breaker in whether or not you are offered a position.

Suggested answer: “I’m making $X now. I understand that the salary range for this position is $XX – $XX. Like most people, I would like to improve on my salary, but I’m more interested in the job itself than the money. I would be open to negotiating a lower starting salary but would hope that we can revisit the subject in a few months after I’ve proved myself to you.”

ASP.Net Life Cycle


Seq Events Controls Initialized View state Form data What Logic can be written here?
Available Available
1 Init No No No Note: You can access form data etc. by using ASP.NET request objects but not by Server controls.Creating controls dynamically, in case you have controls to be created on runtime. Any setting initialization.Master pages and them settings. In this section, we do not have access to viewstate , posted values and neither the controls are initialized.
2 Load view state Not guaranteed Yes Not guaranteed You can access view state and any synch logic where you want viewstate to be pushed to behind code variables can be done here.
3 PostBackdata Not guaranteed Yes Yes You can access form data. Any logic where you want the form data to be pushed to behind code variables can be done here.
4 Load Yes Yes Yes This is the place where you will put any logic you want to operate on the controls. Like flourishing a combobox from the database, sorting data on a grid, etc. In this event, we get access to all controls, viewstate and their posted values.
5 Validate Yes Yes Yes If your page has validators or you want to execute validation for your page, this is the right place to the same.
6 Event Yes Yes Yes If this is a post back by a button click or a dropdown change, then the relative events will be fired. Any kind of logic which is related to that event can be executed here.
7 Pre-render Yes Yes Yes If you want to make final changes to the UI objects like changing tree structure or property values, before these controls are saved in to view state.
8 Save view state Yes Yes Yes Once all changes to server controls are done, this event can be an opportunity to save control data in to view state.
9 Render Yes Yes Yes If you want to add some custom HTML to the output this is the place you can.
10 Unload Yes Yes Yes Any kind of clean up you would like to do here.
Gallery

{ SQL Function Difference } Scalar , Inline , table-valued functions and Multi-Statement table-valued functions


 Scalar function, Inline table-valued functions and Multi-Statement table-valued functions are User defined functions.

Scalar Functions: A scalar function accepts any number of parameters and returns one value.The term scalar differentiates a single, “flat” value from more complex structured values, such as arrays or result sets.  This pattern is much like that of traditional functions written in common programming language.

Inline Table-Valued Functions: This type of functions returns a result set, much like a view. How ever ,unlike a view,functions can accept parameters. The inline function’s syntax is quite simple.In the function definition, the return type is set to a table. A return statement is used with a select query in parenthesis.

Multi-Statement Table-Valued Functions: Multi-Statement functions can be used to do some very unique things outside the context of a standard SELECT statement. This type of function returns a table-type result set,but the table is explicitly constructed in script. This can be used to accomplish one of two things: either to process some very unique business logic by assembling a virtual table on the fly,or to duplicate the functionality of an inline function in a more verbose and compiled way. In sort,if you need to select records from an existing a result set,use an inline table-valued function.

PARTIAL CLASSES IN C#.NET – EXAMPLES USAGE DEFINITION


Partial Classes in C#.Net – examples usage definition

 
Definition :Partial types are allow to define a single class in multiple files (more than one file), when compilation time theses classes are combined to form a single class.

The partial modifier is not available on delegate or enumeration declarations.

Example
//partial class

public partial class Student
{
public virtual void GetRollNo();
}

public partial class Student
{
public virtual void GetStudentName();
}

//Derived class

public class School : Student
{
public void getStudentDetails()
{
GetRollNo();
getStudentDetails(); 
}
}