Posts

Showing posts from October, 2007

Duplicate Column values in a SQL Table

How to Get Values of column having duplicate records in some other column. Scenario I have a table having multiple columns, the two named are ID and email, Now i what i want to do is that i want the values of ID's for those Columns having same email address or duplicate email address. Suppose we have the following table named "Table1" having two fields ID and Email and having following Data. ID Email 1 Email1@Email.com 2 Email1@Email-2.com 3 Email1@Email.com 4 Email1HK@Email.com 5 Email1@Email.com 6 Email1HK@Email.com 7 Email1@Email.com 8 Email1we@Email.net 9 Email1sd@Emailz.com 10 Email1@Email.com 11 Email1n@Email.com 12 Email1@Email.com Use the following SQL Query to get ID's having Duplicate Email address Select ID from Table1 where Name IN (SELECT Name FROM Table1 GROUP BY Name HAVING ( COUNT(Name) > 1 )) Now this Query will return 1,3,5,7,10,12,4 and 6 from the above table having same Data.

Add Custom Configuration Sections In Web.Config (Asp.Net 2.0)

The Configuration Sections that are in Web.Config are basically classes defined in the .Net Framework and we just set the properties for site compilation and other necessary functionalities for site startup. Custom Configuration Section There are a few steps to make your Custom configuration section and configurable class in Asp.Net. Like i am writing a class which needs some custom file path to save temporary data. // Inherit your Class from ConfigurationSection public class SaveEmployeeData : ConfigurationSection { // In the below Line i ma telling .Net to look for // an attribute Web. config file 'TempFolderPath' to retrive value. [ConfigurationProperty( "TempFolderPath" , IsRequired = true )] public string LogFilePath { get { return ( string ) base [ "TempFolderPath" ]; }

The Configuration API in .NET 2.0

.NET 2.0 allows us to read, write, and encrypt sections in configuration files. In this article we will look into the configuration API to prepare for issues regarding permissions, key management, and application restarts. The configuration API in .NET 2.0 gives us the ability to read and update configuration files, including web.config and machine.config files. You can read and write configuration files for your application, for another application on the same machine, or even an application on a different server. In this article, we will take a look at some of the highlights of the configuration API from the perspective of an ASP.NET developer, including how to use encryption and alternate configuration files. AppSettings and Connection Strings Two common tasks in ASP.NET development are reading application setting strings and connection strings from the configuration file. In .NET 2.0 these settings reside in the <appSettings> and <connectionStrings> respectively. A samp

Use configSource attribute to manage Web.Config sections in ASP.Net 2.0

Different Sections in Web.Config can be managed by using external XML files, like Connection strings, Appsettings ..... Create a XML file with the respective settings and put that file in App_Data folder to protect <?xml version="1.0" standalone="yes"?> <connectionstrings> <!-- Connection String for SQL Server 2005 Express --> <add name=" SiteSqlServer " connectionstring=" Your Connection " providername=" System.Data.SqlClient " /> <!-- Connection String for SQL Server 2000/2005 <add name=" SiteSqlServer " connectionstring=" Your Connection " providername=" System.Data.SqlClient " /> --> </connectionstrings> Save the file in App_Data folder you need to change the Settings in Web.Config <connectionstrings configsource="App_Data\yourFileName.xml" /> You can manipulate the values by simply changing the respective XML files. No need to change the Web.Co

Open a new browser in Async Callback

Use the following code in Async Callback to open a new Browser string str_script = "window.open('mypage.aspx?_par2=0&_par1=" + parameters + "',null,'width=510,height=500,top=250,left=250','false');" ; StringBuilder oStringBuilder = new StringBuilder(); oStringBuilder .Append(str_script); ScriptManager .RegisterClientScriptBlock(this.UpdatePanel, typeof( UpdatePanel ), "OpenNewWindow" , oStringBuilder.ToString(), true);
Image