Tuesday, July 10, 2012

aggregate functions in where/having clause

sum, avg, count, min, max, and count(*).these are sql functions to calculate and
summarize data


but it can be possible to use these function in query condition clause
Example : product_stock contains purchase sale

detail of product we have to find product
whose stock is greater than 100
here is,

select product_id, product_name from
product_master inner join on product_stock on
product_master.product_id=product_stock.product_id
group by product_id, product_name
having Sum(product_stock.stock_value)>100

Monday, July 9, 2012

Alter Query sql Sever

Alter Commands in sql Server

Change Datatype of sql server database table column

ALTER TABLE MyTable ALTER COLUMN NullCOl NVARCHAR(20) NOT NULL;

drop Column  from sql server database table column

ALTER TABLE table_name
DROP COLUMN column_name

Change Coloumn Name of sql server database table column

Alter table table_name change old_column_name   new_column_name type size


Change primery key CONSTRAINT of sql server database table
ALTER TABLE table_name
DROP CONSTRAINT PK_table_name_Col1 new_column_name old_column_name column_name datatype

Thursday, July 5, 2012

Web service in asp.net


A Web Service is programmable application logic accessible via standard Web protocols. One of these Web protocols is the Simple Object Access Protocol (SOAP)

Consumers of a Web Service do not need to know anything about the platform, object model, or programming language used to

implement the service; they only need to understand how to send and receive SOAP messages (HTTP and XML).



A Web Service Example

In the following example we will use ASP.NET to create a simple Web Service that adds two numbers

VB.
<%@ WebService Language="VB" Class="MyMath" %>
Public Class MyMath
  Public Function Add(a As Integer, b As Integer) As Integer
    Return a + b
  End Function
End Class


C#.

<%@ WebService Language="VB" Class="MyMath" %>
Public Class MyMath
{

[WebMethod]
  Public int  Add( Int a, Int b )
{
    Return a + b;
}
 
}





Consuming (Calling) Web Service


Web Services can be consumed in 2 ways :

    Select Project / Web site > right-click > Add Web Reference

        Follow the wizard. If you select option “Web service in this solution”, it will do following things

            Creates App_WebReferences folder
            Create localhost having 2 files – .disco & .wsdl
            Then write following code in .aspx > Button click event :
            [Here, WebService is the name of the web service.]

Save a PDF generated from html2pdf in C#, MVC , html2pdf , Ajax code

 To save on server or disk a PDF generated from HTML in C# code example, you can use the      html2pdf js script     html2pdf   converts any...