You can download SQL Server 2008 SP1 from the following location.
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=66ab3dbb-bf3e-4f46-9559-ccc6a4f9dc19
Search This Blog
April 22, 2009
March 23, 2009
Asp.Net Errors and Resolution
1. Sys.WebForms.PageRequestManagerServerErrorException: Exception has been thrown by the target of an invocation.
When used updatePanel and fileupload controls a client side message displays as above.
To resolve this issue follow the following instructions. orginal link
http://forums.asp.net/p/1100270/2468298.aspx#2468298
This works perfect whenever the FileUpload control is a child control of the UpdatePanel's ContentTemplate.However when the FileUpload control is a child control of e.g. a DetailsViews, which is a child control of the UpdatePanel's ContentTemplate, we should not postback the FileUpload control but it's container.
So in this case you would have to postback the DetailsView by using it's ID.
When used updatePanel and fileupload controls a client side message displays as above.
To resolve this issue follow the following instructions. orginal link
http://forums.asp.net/p/1100270/2468298.aspx#2468298
<triggers>
<asp:postbacktrigger controlid="fileUpload1">
</triggers>This works perfect whenever the FileUpload control is a child control of the UpdatePanel's ContentTemplate.However when the FileUpload control is a child control of e.g. a DetailsViews, which is a child control of the UpdatePanel's ContentTemplate, we should not postback the FileUpload control but it's container.
So in this case you would have to postback the DetailsView by using it's ID.
<triggers>
<asp:postbacktrigger controlid="detailsView1" />
</triggers>
January 30, 2009
How to Send email from ASP.NET
In the web.config file add the following configuration
In the ASP.NET code
<system.net>
<mailSettings>
<smtp from="yourmailid@domain.com">
<network host="localhost" port="25" />
</smtp>
</mailSettings>
</system.net>
In the ASP.NET code
try
{
System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient();
Client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.PickupDirectoryFromIis;
Client.Send("Frommailid@domin.com", "tomailid@domain.com", "Mail Sumbjet", "Mail Body");
}
catch (Exception ex)
{
Response.Wrire(ex.Message.ToString());
}
December 29, 2008
How to generate script for data present in database
This tool works for only Microsoft SQL Server 2000 / 2005 Only.
Open the command prompt. Go to the following folder. This folder may vary based on where you installed Sql Server.
C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\1.2
Type the following at the command prompt and press enter. This will take Windows Authentication. Change the databasename and file path as required.
sqlpubwiz script -d DatabaseName C:\FileName.sql
Type the following at the command prompt and press enter. The following command will script the FooDB database from the default instance on a machine named MYSERVER using SQL Server authentication with the username "Alice" and the password "7h92-v6k3" to the file C:\FooDB.sql:
sqlpubwiz script -d FooDB -S MYSERVER -U Alice -P 7h92-v6k3 C:\FooDB.sql
You can also check another free tool "SQL Scripter" at the following site.
http://www.sqlscripter.com/
Open the command prompt. Go to the following folder. This folder may vary based on where you installed Sql Server.
C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\1.2
Type the following at the command prompt and press enter. This will take Windows Authentication. Change the databasename and file path as required.
sqlpubwiz script -d DatabaseName C:\FileName.sql
Type the following at the command prompt and press enter. The following command will script the FooDB database from the default instance on a machine named MYSERVER using SQL Server authentication with the username "Alice" and the password "7h92-v6k3" to the file C:\FooDB.sql:
sqlpubwiz script -d FooDB -S MYSERVER -U Alice -P 7h92-v6k3 C:\FooDB.sql
You can also check another free tool "SQL Scripter" at the following site.
http://www.sqlscripter.com/
December 01, 2008
How to eliminate duplicate rows in a table
/*Create table DupRecords*/
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES t
WHERE t.TABLE_NAME='DUPRECORDS' AND t.TABLE_SCHEMA='dbo')
BEGIN
Create Table dbo.DupRecords
(
id INT not null
,Name varchar(40)
,Salary money
)
END
/*Insert duplicate data*/
insert into DupRecords values
(1,'A', 1000)
,(1,'A', 1000)
,(2,'B',2000)
,(3,'C',3000)
,(2,'B',2000)
,(2,'B',2000)
,(3,'C',3000)
,(4,'D',4000)
If we want to eliminate duplicate rows in a table use the following syntax
/*Display Non duplicate data*/
SELECT distinct * FROM dbo.duprecords
The following code is used to eliminate duplicate rows based on selected columns by displaying all the columns. The columns on which duplicate is decided need to be mentioned after Partition by in the Over() function
SELECT Id,Name,Salary FROM
(
select Id,Name,Salary, ROW_NUMBER()over(partition by id,name,salary order by id) as [RowNumber] from dbo.DupRecords
) t
WHERE RowNumber=1
If we want to display what are the records we need to delete to eliminate duplicate rows in a table we can use the following sql statement.
SELECT Id,Name,Salary FROM
(
select *, ROW_NUMBER()over(partition by id,name,salary order by id) as [RowNumber] from dbo.DupRecords
) t
WHERE RowNumber>1
Subscribe to:
Posts (Atom)