Wednesday, October 27, 2010

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'

Tuesday, July 13, 2010

How to know the number of rows in all the tables in a SQL server 2005 database?

The blow query will show the number of rows in all the tables in a SQL server 2005 database


select distinct sysobjects.name,sysindexes.rows from sysobjects
inner join sysindexes on sysindexes.id=sysobjects.id
where sysobjects.xtype='u'
order by sysindexes.rows desc

or you can use the below querry to the same details

SELECT OBJECT_NAME(OBJECT_ID) TableName, st.row_count

FROM sys.dm_db_partition_stats st
WHERE index_id < 2
ORDER BY st.row_count DESC

Saturday, July 10, 2010

How to clear the text values of an Ajax ComboBox control?

Today I had Googled a lot to find a solution for clearing the text box values of an Ajax ComboBox, but unfortunately I could find any accurate solution. Then I finally decided to make some changes to the code which is published in my blog (http://rajeshkamalakshan.blogspot.com/2010/05/how-to-get-selected-text-of-microsoft.html) to achieve the above result.

For all you please find the code to clear the text box values of an Ajax ComboBox

Friday, June 4, 2010

How to insert mutlitiple rows into a table using insert and select statement?

Please find below how you can insert mutipe rows to a table by uing a select satement .
 for this example let us create a table as below

create table Batting (Player varchar(10), Year int, Team varchar(10), HomeRuns int, primary key(Player,Year))

The row to the above table can be inserted by uing the below sql querry.
 insert into Batting

select 'A',2001,'Red Sox',13 union all
select 'A',2002,'Red Sox',23 union all
select 'A',2003,'Red Sox',19 union all
select 'A',2004,'Red Sox',14 union all
select 'A',2005,'Red Sox',11 union all
select 'B',2001,'Yankees',42 union all
select 'B',2002,'Yankees',39 union all
select 'B',2003,'Yankees',42 union all
select 'B',2004,'Yankees',29 union all
select 'C',2002,'Yankees',2 union all
select 'C',2003,'Yankees',3 union all
select 'C',2004,'Red Sox',6 union all
select 'C',2005,'Red Sox',9