
Friday, June 25, 2010
Wednesday, June 16, 2010
What is .Net Web Service?
Web service is the way to publish application's function on web that can be accessible to the rest of the world.
Web services are the components that can be used by other applications
ASP.NET offers easy way to develop web services, just precede the functions with a special WebMethod ()> attribute in order them to work as Web Service.
Web services are discovered using UDDI directory services.
Web services are built on XML standard and use SOAP protocol that allows them to communicate across different platforms and programming languages.
Web services easily manage to work across corporate firewalls as they use HTTP protocol which is firewall friendly.
Web services platform elements are
SOAP (Simple Object Access Protocol)
UDDI (Universal Description, Discovery and Integration)
WSDL (Web Services Description Language)
The web services are built on internet standards that are not platform or language specific.
The .Net framework provides in-built classes to build and consume web services.
The components offered by web services are reusable.
The examples of web service components can be shipment tracking, translation utility, weather forecasting, sports scores etc.
Web services are the components that can be used by other applications
ASP.NET offers easy way to develop web services, just precede the functions with a special WebMethod ()> attribute in order them to work as Web Service.
Web services are discovered using UDDI directory services.
Web services are built on XML standard and use SOAP protocol that allows them to communicate across different platforms and programming languages.
Web services easily manage to work across corporate firewalls as they use HTTP protocol which is firewall friendly.
Web services platform elements are
SOAP (Simple Object Access Protocol)
UDDI (Universal Description, Discovery and Integration)
WSDL (Web Services Description Language)
The web services are built on internet standards that are not platform or language specific.
The .Net framework provides in-built classes to build and consume web services.
The components offered by web services are reusable.
The examples of web service components can be shipment tracking, translation utility, weather forecasting, sports scores etc.
Labels:
What is .Net Web Service?
Thursday, June 10, 2010
Delete Duplicate Data through single select query.
with t as
(
select * , row_number() over (partition by empid order by empid) as rank from emp
)
delete from t where rank>1
(
select * , row_number() over (partition by empid order by empid) as rank from emp
)
delete from t where rank>1
Wednesday, June 2, 2010
XML Nodes by Name
//Xml
Names>
name>
firstname>John
lastname>Smith
/Name>
name>
firstname>James
lastname>White
/Name>
/Names>
//C#
XmlDocument xml = new XmlDocument();
xml.Load(myXmlString); // suppose that myXmlString contains "... "
XmlNodeList xnList = xml.SelectNodes("/Names/Name");
foreach (XmlNode xn in xnList)
{
string firstName = xn["FirstName"].InnerText;
string lastName = xn["LastName"].InnerText;
Console.WriteLine("Name: {0} {1}", firstName, lastName);
}
Names>
name>
firstname>John
lastname>Smith
/Name>
name>
firstname>James
lastname>White
/Name>
/Names>
//C#
XmlDocument xml = new XmlDocument();
xml.Load(myXmlString); // suppose that myXmlString contains "
XmlNodeList xnList = xml.SelectNodes("/Names/Name");
foreach (XmlNode xn in xnList)
{
string firstName = xn["FirstName"].InnerText;
string lastName = xn["LastName"].InnerText;
Console.WriteLine("Name: {0} {1}", firstName, lastName);
}
Labels:
Select XML Nodes by Name
Wednesday, April 28, 2010
Transaction in sqlserver
begin tran
begin try
insert into a(id) values('a')
insert into a1 values('sdf','adsf1212121',10012121)
commit tran
print'commit'
end try
begin catch
print'rollback'
rollback tran
end catch
begin try
insert into a(id) values('a')
insert into a1 values('sdf','adsf1212121',10012121)
commit tran
print'commit'
end try
begin catch
print'rollback'
rollback tran
end catch
Labels:
Transaction in sqlserver
Monday, April 26, 2010
Static Classes
A class can be declared static, indicating that it contains only static members. It is not possible to create instances of a static class using the new keyword. Static classes are loaded automatically by the .NET Framework common language runtime (CLR) when the program or namespace containing the class is loaded.
Use a static class to contain methods that are not associated with a particular object. For example, it is a common requirement to create a set of methods that do not act on instance data and are not associated to a specific object in your code. You could use a static class to hold those methods.
The main features of a static class are:
They only contain static members.
They cannot be instantiated.
They are sealed.
They cannot contain Instance Constructors (C# Programming Guide).
Creating a static class is therefore much the same as creating a class that contains only static members and a private constructor. A private constructor prevents the class from being instantiated.
The advantage of using a static class is that the compiler can check to make sure that no instance members are accidentally added. The compiler will guarantee that instances of this class cannot be created.
Static classes are sealed and therefore cannot be inherited. Static classes cannot contain a constructor, although it is still possible to declare a static constructor to assign initial values or set up some static state.
Use a static class to contain methods that are not associated with a particular object. For example, it is a common requirement to create a set of methods that do not act on instance data and are not associated to a specific object in your code. You could use a static class to hold those methods.
The main features of a static class are:
They only contain static members.
They cannot be instantiated.
They are sealed.
They cannot contain Instance Constructors (C# Programming Guide).
Creating a static class is therefore much the same as creating a class that contains only static members and a private constructor. A private constructor prevents the class from being instantiated.
The advantage of using a static class is that the compiler can check to make sure that no instance members are accidentally added. The compiler will guarantee that instances of this class cannot be created.
Static classes are sealed and therefore cannot be inherited. Static classes cannot contain a constructor, although it is still possible to declare a static constructor to assign initial values or set up some static state.
Labels:
Static Classes
STUFF vs REPLACE in Asp.net
STUFF - Deletes a specified length of characters and inserts another set of characters at a specified starting point.
SELECT STUFF('abcdef', 2, 3, 'ijklmn')
GO
Here is the result set:
---------
aijklmnef
REPLACE - Replaces all occurrences of the second given string expression in the first string expression with a third expression.
SELECT REPLACE('abcdefghicde','cde','xxx')
GO
Here is the result set:
------------
abxxxfghixxx
SELECT STUFF('abcdef', 2, 3, 'ijklmn')
GO
Here is the result set:
---------
aijklmnef
REPLACE - Replaces all occurrences of the second given string expression in the first string expression with a third expression.
SELECT REPLACE('abcdefghicde','cde','xxx')
GO
Here is the result set:
------------
abxxxfghixxx
Labels:
STUFF vs REPLACE in Asp.net
Subscribe to:
Posts (Atom)