Turning off friendly errors in MOSS

Click Here to visit Zonix’s Website

We found many times sharepoint only display some text like unknown/unspecified error occured. If you want to sharepoint display you to proper error follow below given article.

While in development, the friendly error page that SharePoint displays when our page has an error can make debugging master page issues very difficult.
We can make an easy change to the Web config file for the site to turn friendly error messages off, therefore providing us with more useful information if page breaks. Only do the following in a development environment, and we should never want to turn off friendly error messages in a production environment. Also be sure to make a back up of the file prior to editing.
1. On the Web server, navigate to the site directory:Local Drive:InetpubwwwrootwssVirtualDirectories[directory for site]
2. Open Web.config in Notepad.
3. Search for “CallStack”. Change the CallStack status to “true”.
4. Search for “CustomErrors”. Change the mode to “off”.
5. Save and close the file.
Now when the site encounters an error, you will receive a .NET screen outlining the issue instead of the friendly SharePoint error screen. This is particularly useful with dealing with missing Content Placeholders and editing Master Pages. To turn friendly error messages back on, just walk through these steps setting the CallStack to false and CustomErrors mode to On.


Bookmark and Share


Bookmark and Share

Web Application Performance

Click Here to visit Zonix’s Website

Web Application performance can be enhanced by considering the following points:

1. Database ResultSets
2. Paging
3. Connection Pooling
4. Server Control View State
5. Caching

Below are details of the points:

Database Resultsets
Review your database code to see if you have request paths that go to the database more than once. Each of those round-trips decreases the number of requests per second your application can serve. By returning multiple resultsets in a single database request, you can cut the total time spent communicating with the database. You’ll be making your system more scalable; too, as you’ll cut down on the work the database server is doing managing requests.

While you can return multiple resultsets using dynamic SQL, I prefer to use stored procedures. It’s arguable whether business logic should reside in a stored procedure, but I think that if logic in a stored procedure can constrain the data returned (reduce the size of the dataset, time spent on the network, and not having to filter the data in the logic tier), it’s a good thing.

Using a SqlCommand instance and its ExecuteReader method to populate strongly typed business classes, you can move the resultset pointer forward by calling NextResult. Returning only the data you need from the database will additionally decrease memory allocations on your server.

// read the first resultset
reader = command.ExecuteReader();

// read the data from that resultset
while (reader.Read()) {
suppliers.Add(PopulateSupplierFromIDataReader( reader ));
}

// read the next resultset
reader.NextResult();

// read the data from that second resultset
while (reader.Read()) {
products.Add(PopulateProductFromIDataReader( reader ));
}
Paging

Good approach to writing better paging code is to use stored procedures

CREATE PROCEDURE northwind_OrdersPaged
(
@PageIndex int,
@PageSize int
)
AS
BEGIN
DECLARE @PageLowerBound int
DECLARE @PageUpperBound int
DECLARE @RowsToReturn int

— First set the rowcount
SET @RowsToReturn = @PageSize * (@PageIndex + 1)
SET ROWCOUNT @RowsToReturn

— Set the page bounds
SET @PageLowerBound = @PageSize * @PageIndex
SET @PageUpperBound = @PageLowerBound + @PageSize + 1

— Create a temp table to store the select results
CREATE TABLE #PageIndex
(
IndexId int IDENTITY (1, 1) NOT NULL,
OrderID int
)

— Insert into the temp table
INSERT INTO #PageIndex (OrderID)
SELECT
OrderID
FROM
Orders
ORDER BY
OrderID DESC

— Return total count
SELECT COUNT(OrderID) FROM Orders

— Return paged results
SELECT
O.*
FROM
Orders O,
#PageIndex PageIndex
WHERE
O.OrderID = PageIndex.OrderID AND
PageIndex.IndexID > @PageLowerBound AND
PageIndex.IndexID < @PageUpperBound
ORDER BY
PageIndex.IndexID

END

Connection Pooling

Of course you need to watch out for leaking connections. Always close your connections when you’re finished with them. I repeat: no matter what anyone says about garbage collection within the Microsoft® .NET Framework, always call Close or Dispose explicitly on your connection when you are finished with it. Do not trust the common language runtime (CLR) to clean up and close your connection for you at a predetermined time. The CLR will eventually destroy the class and force the connection closed, but you have no guarantee when the garbage collection on the object will actually happen.

To use connection pooling optimally, there are a couple of rules to live by. First, open the connection, do the work, and then close the connection. It’s okay to open and close the connection multiple times on each request if you have to (optimally you apply Tip 1) rather than keeping the connection open and passing it around through different methods. Second, use the same connection string (and the same thread identity if you’re using integrated authentication). If you don’t use the same connection string, for example customizing the connection string based on the logged-in user, you won’t get the same optimization value provided by connection pooling. And if you use integrated authentication while impersonating a large set of users, your pooling will also be much less effective. The .NET CLR data performance counters can be very useful when attempting to track down any performance issues that are related to connection pooling.

Whenever your application is connecting to a resource, such as a database, running in another process, you should optimize by focusing on the time spent connecting to the resource, the time spent sending or retrieving data, and the number of round-trips. Optimizing any kind of process hop in your application is the first place to start to achieve better performance.

The application tier contains the logic that connects to your data layer and transforms data into meaningful class instances and business processes. For example, in Community Server, this is where you populate a Forums or Threads collection, and apply business rules such as permissions; most importantly it is where the Caching logic is performed.

Server Control View State

View state is a fancy name for ASP.NET storing some state data in a hidden input field inside the generated page. When the page is posted back to the server, the server can parse, validate, and apply this view state data back to the page’s tree of controls. View state is a very powerful capability since it allows state to be persisted with the client and it requires no cookies or server memory to save this state. Many ASP.NET server controls use view state to persist settings made during interactions with elements on the page, for example, saving the current page that is being displayed when paging through data.

There are a number of drawbacks to the use of view state, however. First of all, it increases the total payload of the page both when served and when requested. There is also an additional overhead incurred when serializing or deserializing view state data that is posted back to the server. Lastly, view state increases the memory allocations on the server.

Several server controls, the most well known of which is the DataGrid, tend to make excessive use of view state, even in cases where it is not needed. The default behavior of the ViewState property is enabled, but if you don’t need it, you can turn it off at the control or page level. Within a control, you simply set the EnableViewState property to false, or you can set it globally within the page using this setting:

If you are not doing postbacks in a page or are always regenerating the controls on a page on each request, you should disable view state at the page level.


Bookmark and Share


Bookmark and Share

Advice to young programmers

Click Here to visit Zonix’s Website

(This is the summary of speech Given by Alex Stepenov (Principal Scientist, Adobe Systems) at Adobe India on 30 Nov 2004. )

1. Study , Study and Study

– Never ever think that you have acquired all or most of the knowledge which exists in the world. Almost everybody in US at age of 14 and everybody in India at age of 24 starts thinking that he has acquired all the wisdom and knowledge that he needs. This should be strictly avoided.

– You should be habituated to studies…exactly in the same way as you are habituated to brushing teeth and taking bath every morning. The habit of study must become a ‘part of your blood’. And the study should be from both the areas: CS, since it is your profession, and something from non-CS…Something which doesnot relate to your work. This would expand your knowledge in other field too. A regular study, everyday, is extremely essential. It doesnot matter whether you study of 20 minutes of 2 hours, but consistency is a must.

– You should always study basics and fundamentals. There is no point in going for advanced topics. When I was at the age of 24, I wanted to do PhD in program verification, though I was not able to understand anything from that. The basic reason was that my fundamental concepts were not clear. Studying ‘Algebraic Geometry’ is useless if you donot understand basics in Algebra and Geometry. Also, you should always go back and re-read and re-iterate over the fundamental concepts.

What is the exact definition of ‘fundamental’? The stuff which is around for a while and which forms basic part of the concepts can be regarded as more fundamental. Of course, everybody understands what a fundamental means.

– Here are few books which I would strongly recommend that every CS professional should read and understand.

i. “Structure and Interpretation of Computer Programs” by Albenson and Sussman

I personally donot like the material present in this book and I do have some objections about it but this is the best book I have ever seen which explains all the concepts in programming in a clear and excellent way.

This book is available online at http://mitpress.mit.edu/sicp/

ii. Introduction to Computer Architecture: by Hennessy and Patterson.

How many of you have shipped the programs by writing them in assembly? A very good understanding of basics of how a computer operates is what every CS professional must have.

H&P Wrote two books on CA. I am talking about their first book, the introductory text for understanding basic aspects of how a computer works.

Even if you feel that you know whatever is written in that book, donot stop reading. It’s good to revise basics again and again.

iii. “Fundamentals of Programming” by Donald Knuth.

The core of CS is algorithms and Data structures. Every CS professional must have the 3 volumes of Knuth’s Book on programming. It really doesnot matter if you take 30 years of your life to understand what Knuth has written, what is more important is that you read atleast some part of that book everyday without fail.

iv. Introduction to Algorithms by Cormen, Leiserson and Rivest

This book should be read daily to keep your concepts fresh. This is the best book for fundamental concepts in algorithms.

2. Learn Professional Ethics

– As a CS Professional, you are morally obliged to do a good job. What this means is that you are supposed to do your job not for your manager but for yourself. This is already told in Bhagwatgeeta : Doing duties of your life.

– The direct implication of this is: never ever write a bad code. You don’t need to be fastest and run after shipping dates; rather you need to write quality code. Never write junk code. Rewrite it till it is good. Thoroughly test every piece of code that you write. Donot write codes which are “sort of allright”. You might not achieve perfection, but atleast your code should be of good quality.

– Let me quote my own example in this context. You might have heard about STL, The Standard Template Library that ships in with C++ compilers. I wrote it 10 years ago, in 1994. While implementing one of the routines in the STL, namely the “search routine”, I was a bit lazy and instead of writing a good linear order implementation of KMP which was

difficult to code, I wrote a best quadratic implementation. I knew that I could make the search faster by writing a linear-order implementation, but I was lazy and I did not do that. And, after 10 years of my writing STL, exactly the same implementation is still used inside STL and STL ships with an inefficient quadratic implementation of search routine even today!! You might ask me: why can’t you rewrite that? Well…I cannot, because that code is no more my property!! Further, nobody today will be interested in a standalone efficient STL …people would prefer one which automatically ships out with the compiler itself.

– Moral is, you should have aesthetic beauty built inside you. You should “feel” uneasy on writing bad code and should be eager to rewrite the code till it becomes upto the quality. And to the judge the quality, you need to develop sense regarding which algorithms to use under what circumstances.

3. Figure out your Goals

– Always aspire doing bigger things in life

– “Viewing promotion path as your career” is a completely wrong goal. If you are really interested in studying and learning new things, never ever aspire for being a manager. Managers cannot learn and study…they have no time. “Company ladder aspiration” is not what should be important for you.

– You might feel that you want to do certain things which you cannot do till you become a manager. When you become a manager, you will soon realize that now you just cannot do anything!

– You will have a great experience as programmers. But if you care for people and love people, you will never enjoy being a manager…most good managers are reluctant managers. If you see people as people, you cannot survive at management level.

– Always aspire for professional greatness. Our profession is very beautiful because we create abstract models and implement them in reality. There is a big fun in doing that. We have a profession which allows us to do creative things and even gives nice salary for that.

– The three biggest mistakes that people usually make are aiming for money, aiming for promotion and aiming for fame. The moment you get some of these, you aspire for some more…and then there is no end. I donot mean that you shouldnot earn money, but you should understand how much

money would satisfy your needs. Bill Clinton might be the richest person in the world; he is certainly not the happiest. Our lives are far better than his.

– Find your goal, and do best in the job that you have. Understand that what is in your pocket doesnot matter…what is in your brain finally matters. Money and fame donot matter. Knowledge matters.

4. Follow your culture

I have seen the tradition that whatever junk is created in US, it rapidly spreads up in the rest of the world, and India is not an exception for this. This cultural change creates a very strong impact on everybody’s life. Habits of watching spicy Bollywood or Hollywood movies and listening to pop songs and all such stupid stuff gets very easily cultivated in people of your age…but believe me, there is nothing great in that. This all just makes you run away from your culture. And there is no wisdom in running away from your culture. Indian culture, which has great Vedas and stories like Mahabharata and Bhagwatgeeta is really great and even Donald Knuth enjoys reading that. You should understand that fundamental things in Indian culture teach you a lot and you should never forget them.

Finally, I would like to conclude by saying that it’s your life…donot waste it on stupid things…develop your tests, and start the fight.

Courtesy: The Seo Guru, A Software Development Company, Best OOPS Blog Site, Link Submission, Thanks to Shopping  Site for Link Exchanging


Bookmark and Share

Advice to young programmers

Click Here to visit Zonix’s Website

(This is the summary of speech Given by Alex Stepenov (Principal Scientist, Adobe Systems) at Adobe India on 30 Nov 2004. )

1. Study , Study and Study

– Never ever think that you have acquired all or most of the knowledge which exists in the world. Almost everybody in US at age of 14 and everybody in India at age of 24 starts thinking that he has acquired all the wisdom and knowledge that he needs. This should be strictly avoided.

– You should be habituated to studies…exactly in the same way as you are habituated to brushing teeth and taking bath every morning. The habit of study must become a ‘part of your blood’. And the study should be from both the areas: CS, since it is your profession, and something from non-CS…Something which doesnot relate to your work. This would expand your knowledge in other field too. A regular study, everyday, is extremely essential. It doesnot matter whether you study of 20 minutes of 2 hours, but consistency is a must.

– You should always study basics and fundamentals. There is no point in going for advanced topics. When I was at the age of 24, I wanted to do PhD in program verification, though I was not able to understand anything from that. The basic reason was that my fundamental concepts were not clear. Studying ‘Algebraic Geometry’ is useless if you donot understand basics in Algebra and Geometry. Also, you should always go back and re-read and re-iterate over the fundamental concepts.

What is the exact definition of ‘fundamental’? The stuff which is around for a while and which forms basic part of the concepts can be regarded as more fundamental. Of course, everybody understands what a fundamental means.

– Here are few books which I would strongly recommend that every CS professional should read and understand.

i. “Structure and Interpretation of Computer Programs” by Albenson and Sussman

I personally donot like the material present in this book and I do have some objections about it but this is the best book I have ever seen which explains all the concepts in programming in a clear and excellent way.

This book is available online at http://mitpress.mit.edu/sicp/

ii. Introduction to Computer Architecture: by Hennessy and Patterson.

How many of you have shipped the programs by writing them in assembly? A very good understanding of basics of how a computer operates is what every CS professional must have.

H&P Wrote two books on CA. I am talking about their first book, the introductory text for understanding basic aspects of how a computer works.

Even if you feel that you know whatever is written in that book, donot stop reading. It’s good to revise basics again and again.

iii. “Fundamentals of Programming” by Donald Knuth.

The core of CS is algorithms and Data structures. Every CS professional must have the 3 volumes of Knuth’s Book on programming. It really doesnot matter if you take 30 years of your life to understand what Knuth has written, what is more important is that you read atleast some part of that book everyday without fail.

iv. Introduction to Algorithms by Cormen, Leiserson and Rivest

This book should be read daily to keep your concepts fresh. This is the best book for fundamental concepts in algorithms.

2. Learn Professional Ethics

– As a CS Professional, you are morally obliged to do a good job. What this means is that you are supposed to do your job not for your manager but for yourself. This is already told in Bhagwatgeeta : Doing duties of your life.

– The direct implication of this is: never ever write a bad code. You don’t need to be fastest and run after shipping dates; rather you need to write quality code. Never write junk code. Rewrite it till it is good. Thoroughly test every piece of code that you write. Donot write codes which are “sort of allright”. You might not achieve perfection, but atleast your code should be of good quality.

– Let me quote my own example in this context. You might have heard about STL, The Standard Template Library that ships in with C++ compilers. I wrote it 10 years ago, in 1994. While implementing one of the routines in the STL, namely the “search routine”, I was a bit lazy and instead of writing a good linear order implementation of KMP which was

difficult to code, I wrote a best quadratic implementation. I knew that I could make the search faster by writing a linear-order implementation, but I was lazy and I did not do that. And, after 10 years of my writing STL, exactly the same implementation is still used inside STL and STL ships with an inefficient quadratic implementation of search routine even today!! You might ask me: why can’t you rewrite that? Well…I cannot, because that code is no more my property!! Further, nobody today will be interested in a standalone efficient STL …people would prefer one which automatically ships out with the compiler itself.

– Moral is, you should have aesthetic beauty built inside you. You should “feel” uneasy on writing bad code and should be eager to rewrite the code till it becomes upto the quality. And to the judge the quality, you need to develop sense regarding which algorithms to use under what circumstances.

3. Figure out your Goals

– Always aspire doing bigger things in life

– “Viewing promotion path as your career” is a completely wrong goal. If you are really interested in studying and learning new things, never ever aspire for being a manager. Managers cannot learn and study…they have no time. “Company ladder aspiration” is not what should be important for you.

– You might feel that you want to do certain things which you cannot do till you become a manager. When you become a manager, you will soon realize that now you just cannot do anything!

– You will have a great experience as programmers. But if you care for people and love people, you will never enjoy being a manager…most good managers are reluctant managers. If you see people as people, you cannot survive at management level.

– Always aspire for professional greatness. Our profession is very beautiful because we create abstract models and implement them in reality. There is a big fun in doing that. We have a profession which allows us to do creative things and even gives nice salary for that.

– The three biggest mistakes that people usually make are aiming for money, aiming for promotion and aiming for fame. The moment you get some of these, you aspire for some more…and then there is no end. I donot mean that you shouldnot earn money, but you should understand how much

money would satisfy your needs. Bill Clinton might be the richest person in the world; he is certainly not the happiest. Our lives are far better than his.

– Find your goal, and do best in the job that you have. Understand that what is in your pocket doesnot matter…what is in your brain finally matters. Money and fame donot matter. Knowledge matters.

4. Follow your culture

I have seen the tradition that whatever junk is created in US, it rapidly spreads up in the rest of the world, and India is not an exception for this. This cultural change creates a very strong impact on everybody’s life. Habits of watching spicy Bollywood or Hollywood movies and listening to pop songs and all such stupid stuff gets very easily cultivated in people of your age…but believe me, there is nothing great in that. This all just makes you run away from your culture. And there is no wisdom in running away from your culture. Indian culture, which has great Vedas and stories like Mahabharata and Bhagwatgeeta is really great and even Donald Knuth enjoys reading that. You should understand that fundamental things in Indian culture teach you a lot and you should never forget them.

Finally, I would like to conclude by saying that it’s your life…donot waste it on stupid things…develop your tests, and start the fight.

Courtesy: The Seo Guru, A Software Development Company, Best OOPS Blog Site, Link Submission, Thanks to Shopping  Site for Link Exchanging


Bookmark and Share

Passing lists to SQL server stored procedures

Click Here to visit Zonix’s Website

Article is about:

The ability to pass “a list of values” from .Net as a parameter to a T-SQL based stored procedure.

Scenarios:

There are lots of scenarios where we need to pass a list of values to save in database. Here’s a couple of obvious ones:

INSERT a list of values into the database in one “chunky” call (e.g. some IDs from a CheckBoxList)
SELECT rows where IDs are IN ()
Some general Approaches:

Taking the INSERT statements as an example, there are various general approaches that we adopt to achieve the desired result:

Use dynamic / Inline SQL! But ideally say, dynamic / Inline SQL is rarely the ideal solution for obvious reasons.
Make a stored proc call for each ID to insert. This is the most common approach we see in various projects, mainly because it is the easiest to implement. The drawback of course is if we were to insert 60 values, it would result in 60 “chatty” calls to the database.
Pass comma separated values via a VARCHAR (or similar) parameter. This works fine but has messy “string splitting” in the stored procedure to extract the IDs and then build the SQL statement in the procedure itself. Prone to SQL injection and not the best performance.
Pass the list as an XML parameter. This is nicer and is the point of this article.
Coming to the main Point, Using XML:

Using XML for “list passing” has a number of benefits, in particular the ability to pass lists of more “complex types” rather than just single values.

Lets take an example. Suppose we are having 2 CheckedListBox; one is list of Users and another is the list of tasks / roles that can be assigned to Users. We want to store the values in Table which is having Fields UserID and TaskID. The Stored Procedure will accept Parameter with XML Datatype as,

CREATE PROCEDURE [dbo].[usp_InsertUserTask]
@UserTaskXML XML
AS
BEGIN
INSERT INTO UserTasks (UserID,TaskID)
SELECT
UserTaskTab.UserTaskCol.value(‘UserID[1]’,’int’) AS UserID,
UserTaskTab.UserTaskCol.value(‘TaskID[1]’,’int’) AS TaskID
FROM @UserTaskXML.nodes(‘//UserTaskList/UserTaskData’) AS UserTaskTab(UserTaskCol)
END

To call this in Stored Procedure, you would have something like this:

EXEC [dbo].[usp_InsertUserTask]
@UserTaskXML = ‘

1
100

2
200

In your application, your C# calling code could be:

SqlConnection sqlCN = new SqlConnection();
sqlCN.ConnectionString = ConfigurationManager.AppSettings[“DBConn”].ToString();
string strQuery = “usp_InsertUserTask”;
SqlParameter[] sqlParams = new SqlParameter[1];
sqlParams[0] = new SqlParameter(“@UserTaskXML”, GetStudyDataXMLString());
SqlHelper.ExecuteNonQuery(sqlCN, CommandType.StoredProcedure, strQuery, sqlParams);
if (sqlCN.State == ConnectionState.Open)
sqlCN.Close();
sqlCN.Dispose();

which calls the method below to translate the UserID and TaskID from CheckBoxLists into an XML String:

private string GetUserTaskListXML()
{
try
{
StringBuilder XMLString = new StringBuilder();
XMLString.AppendFormat(“”);
for (int iUserCount = 0; iUserCount < UserCheckBoxList.Items.Count; iUserCount++)
{
if(UserCheckBoxList.Items[iUserCount].Selected)
{
for (int iTaskCount = 0; iTaskCount < TaskCheckBoxList.Items.Count; iTaskCount++)
{
if(TaskCheckBoxList.Items[iTaskCount].Selected)
{
XMLString.AppendFormat(“”);
XMLString.AppendFormat(“{0}”, UserCheckBoxList.Items[iUserCount].value);
XMLString.AppendFormat(“{0}”, UserCheckBoxList.Items[iUserCount].value);
XMLString.AppendFormat(“”);
}
}
}
}
XMLString.AppendFormat(“”);
}
catch (Exception Ex)
{
throw Ex;
}
return XMLString.ToString();
}

Here, StringBuilder is used for the xml concatenation as in this case I think it fits the bill but purists might prefer an XmlTextWriter approach. In summary, it performs very well and is adaptable for various lists of objects and more complex structures.

Referenced Link:

Passing lists to SQL server stored procedures


Bookmark and Share

Passing lists to SQL server stored procedures

Click Here to visit Zonix’s Website

Article is about:

The ability to pass “a list of values” from .Net as a parameter to a T-SQL based stored procedure.

Scenarios:

There are lots of scenarios where we need to pass a list of values to save in database. Here’s a couple of obvious ones:

INSERT a list of values into the database in one “chunky” call (e.g. some IDs from a CheckBoxList)
SELECT rows where IDs are IN ()
Some general Approaches:

Taking the INSERT statements as an example, there are various general approaches that we adopt to achieve the desired result:

Use dynamic / Inline SQL! But ideally say, dynamic / Inline SQL is rarely the ideal solution for obvious reasons.
Make a stored proc call for each ID to insert. This is the most common approach we see in various projects, mainly because it is the easiest to implement. The drawback of course is if we were to insert 60 values, it would result in 60 “chatty” calls to the database.
Pass comma separated values via a VARCHAR (or similar) parameter. This works fine but has messy “string splitting” in the stored procedure to extract the IDs and then build the SQL statement in the procedure itself. Prone to SQL injection and not the best performance.
Pass the list as an XML parameter. This is nicer and is the point of this article.
Coming to the main Point, Using XML:

Using XML for “list passing” has a number of benefits, in particular the ability to pass lists of more “complex types” rather than just single values.

Lets take an example. Suppose we are having 2 CheckedListBox; one is list of Users and another is the list of tasks / roles that can be assigned to Users. We want to store the values in Table which is having Fields UserID and TaskID. The Stored Procedure will accept Parameter with XML Datatype as,

CREATE PROCEDURE [dbo].[usp_InsertUserTask]
@UserTaskXML XML
AS
BEGIN
INSERT INTO UserTasks (UserID,TaskID)
SELECT
UserTaskTab.UserTaskCol.value(‘UserID[1]’,’int’) AS UserID,
UserTaskTab.UserTaskCol.value(‘TaskID[1]’,’int’) AS TaskID
FROM @UserTaskXML.nodes(‘//UserTaskList/UserTaskData’) AS UserTaskTab(UserTaskCol)
END

To call this in Stored Procedure, you would have something like this:

EXEC [dbo].[usp_InsertUserTask]
@UserTaskXML = ‘

1
100

2
200

In your application, your C# calling code could be:

SqlConnection sqlCN = new SqlConnection();
sqlCN.ConnectionString = ConfigurationManager.AppSettings[“DBConn”].ToString();
string strQuery = “usp_InsertUserTask”;
SqlParameter[] sqlParams = new SqlParameter[1];
sqlParams[0] = new SqlParameter(“@UserTaskXML”, GetStudyDataXMLString());
SqlHelper.ExecuteNonQuery(sqlCN, CommandType.StoredProcedure, strQuery, sqlParams);
if (sqlCN.State == ConnectionState.Open)
sqlCN.Close();
sqlCN.Dispose();

which calls the method below to translate the UserID and TaskID from CheckBoxLists into an XML String:

private string GetUserTaskListXML()
{
try
{
StringBuilder XMLString = new StringBuilder();
XMLString.AppendFormat(“”);
for (int iUserCount = 0; iUserCount < UserCheckBoxList.Items.Count; iUserCount++)
{
if(UserCheckBoxList.Items[iUserCount].Selected)
{
for (int iTaskCount = 0; iTaskCount < TaskCheckBoxList.Items.Count; iTaskCount++)
{
if(TaskCheckBoxList.Items[iTaskCount].Selected)
{
XMLString.AppendFormat(“”);
XMLString.AppendFormat(“{0}”, UserCheckBoxList.Items[iUserCount].value);
XMLString.AppendFormat(“{0}”, UserCheckBoxList.Items[iUserCount].value);
XMLString.AppendFormat(“”);
}
}
}
}
XMLString.AppendFormat(“”);
}
catch (Exception Ex)
{
throw Ex;
}
return XMLString.ToString();
}

Here, StringBuilder is used for the xml concatenation as in this case I think it fits the bill but purists might prefer an XmlTextWriter approach. In summary, it performs very well and is adaptable for various lists of objects and more complex structures.

Referenced Link:

Passing lists to SQL server stored procedures


Bookmark and Share

Advantages of Asp.net and Sharepoint – Where to use SharePoint

Click Here to visit Zonix’s Website

Here are some of Advantages/Disadvantages of SharePoint apps over ASP.Net apps:

 

Advantages:

 

1. Many built-in features are available with MOSS which can be used to easily develop complex solutions.

2. Rich Security features which come built in.

3. Integrated with Content Management.

4. Very less efforts required to create basic sites with lot of features.

5. It is quite scalable.

6. OOB Integration with Office products.

7. Rich backup techniques

8. Business process can be integrated with Workflows.

9. Multiple sites can be created with the help of templates.

 

Disadvantages:

1. It is difficult to add custom code in SharePoint. Features and WSP files take time.

2. Difficult to solve the problems in development.

3. Creating ASP.net pages is easy then creating web parts.

4. Cost is very high.

5. Performance for ASP.NET apps is much better.

6. Very few experts are there.

 

Advantages/Disadvantages of ASP.Net apps over SharePoint apps:

 

Advantages:

 

1. Here we have lot of control on application in terms of DB, UI.

2. Less cost to build.

3. Easy to develop and deploy.

4. Plenty of resources.

 

Disadvantages:

1. Takes lot more time to get same functionality as of SharePoint.

2. There is nothing built in. So every solution needs to start from zero.

3. Good DB knowledge is also required to create sites having data.

4. Security needs to build.

What’s SharePoint Not Good For

Click Here to visit Zonix’s Website

SharePoint is an excellent way to create data-driven web sites, in my opinion, but there are other times where I don’t think it’s the best choice. For example, SharePoint isn’t a substitute for a code management library, such as SourceSafe. (Microsoft is working on this for Visual Studio 2008, however, so watch out!) Also, SharePoint’s integration with Microsoft Office, Windows, and .NET means that users of other operating platforms (Mac, Linux) or non-Microsoft browsers may have problems using the sites.

In particular, SharePoint authentication does not seem to work with Internet Explorer for the Macintosh or Mozilla prior to Version 1.7.2. In addition, SharePoint pages look different in FireFox, Mozilla, and Netscape Navigator than they look in Internet Explorer. You can compare these differences by using different browsers to view public SharePoint sites.

Introduction to SharePoint

Click Here to visit Zonix’s Website

  1. Why Use SharePoint?

a.  SharePoint is a component of Windows 2003 that lets you share Microsoft Office documents with others through web pages. Unlike most web sites, SharePoint sites are designed to be highly dynamic. Team members can easily upload documents, add public announcements, send alerts, track work items, and call meetings right from within Office products. 

2.      What is difference between SharePoint Service and SharePoint Server?

  1.  
    1. A Sharepoint service is freely downloadable.
    2. The Windows SharePoint Services are primarily focused around workgroup level collaboration . The main purpose for SharePoint Portal Server is to act as an enterprise level portal.
    3. SharePoint Portal Server was built on top of the Windows SharePoint Services. This means that anything that the Windows SharePoint Services can do, SharePoint Portal Server can also do. Windows SharePoint Service’s primary focus is to create workspaces that small groups of users can use to collaborate on projects by sharing a small collection of documents and other data. Where for SharePoint Portal Server is to act as an enterprise level portal. SharePoint server has some advance feature like searching like we can search for specific keyword. The results of the search can then be arranged by document author, site, date, and category. SharePoint Portal Server also offers hierarchical search scopes that allow users to perform searches from within specific topics, categories, or content sources.
  2. What is the  OS requirement for Windows SharePoint Service?
    1. Windows server 2003.
  3. What Software Requirements at client side for use sharepoint  services features?
    1. Microsoft Internet Explorer 5.01 with SP2 or later (best results with Microsoft Internet Explorer 5.5 with SP2 or later), Microsoft Internet Explorer 5.2 or later for Macintosh, Netscape Navigator version 6.2 or later, Mozilla 1.4 or later, or Firefox 1.0.4 or later 
  4. What types of configuration available for Sharepoint Services?
    1. There are two types of configuration available for sharepoint services and farm server.

                   i.      stand-alone server: if our requirement is hosting  very few sites  and for small organization

                  ii.      server farm:If we are supporting Web sites in a large organization or as an Internetserviceprovider (ISP), and anticipate heavy usage and a lot of data, we will most likely want to use the server farm configuration.


Bookmark and Share