Wednesday, October 27, 2010

How to use Lamda Expression in list.FindIndex() c# to find the index of a charater in chracter array?.

The below code will help you to find the index of a charatecte from the list or array


string[] alphabet = {"A", "B", "C", "D","E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O","P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","1","2","3","4","5","6","7","8","9","0"};

int index= alphabet.ToList().FindIndex(s => s == "G");.

X will contain the index of the character G in the list or array.

You can find more infomration regarding lamda expression from the below link

http://msdn.microsoft.com/en-us/library/bb397687.aspx

How to split a string with more than one delimiter in c#?

The below code will help you to split a string with more than one charatesrs
string Formula = "((1200+2300)4000)";

char[] delimiters = new char[] { '(', ')','+','-','=' };

string[] AcountCodes;

AcountCodes =formula.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)

This issues happens when modifying document while it's being loaded (when browser hasn't "seen" closing tag for this element) . This causes very tricky situation in the parser and in IE it's not allowed For more explanation please vists the IE blog

http://blogs.msdn.com/b/ie/archive/2008/04/23/what-happened-to-operation-aborted.aspx

http://stackoverflow.com/questions/301484/problem-with-html-parser-in-ie

Thursday, October 14, 2010

How to covert an xml values to a table in SQL server 2005?

The below code will read xml data from a variable and will covert it to a temporary table.


Regards Rajesh Kamalakshan

Wednesday, October 13, 2010

How to attach a mdf file to a database in SQL server 2005?

You can use the below command to attach a mdf file to a database in SQL Server 2005.


sp_attach_single_file_db @dbname= 'adminv2', @physname= C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\adminv2.mdf'