Posts

Showing posts from January, 2012

Improve Performance by using OUTPUT in Insert Or Update Statement in single query

Image
Hello friends, recently I needed to fire a single SQL statement for Insert and Update and using the single statement I also needed to return the result of all Inserted/Updated Records details.. after searching a lot ... I came to know a very interesting way to perform both statement in single Query. Generally for the scenario I got lots of suggestions to use Stored Procedure, but which was difficult for my scenario. so I must get solution for it. ok ok... let's come to point. let's we have created a sample Table using the query Create Table Table_1(Id Int Identity,Name nvarchar(100)) to insert records and get its generated Id basically we perform like this Insert into Table_1(Name) Select 'Sandeep' Select @@IDENTITY and same way for update here the Updated value comes from other process which is not available Directly [My case is only For Insert. but the concept we can use in Update also] Declare @NewValue nvarchar(100)='Sandeep Prajapat...

Sample for WCF using json

Here is a sample for start WCF using json in aspx page <script type="text/javascript"> function ajaxService2() { serviceUrl = "http://localhost/WCFS/Service1.svc/GetData"; var time = new Object(); time.value = "1"; $.ajax({ type: "POST", url: serviceUrl, data: JSON.stringify(time), contentType: "application/json; charset=utf-8", dataType: "json", success: function (transport) { var string = transport; $("#<%= Text2.ClientID %>").val(string); }, error: function (ex) { alert("error" + ex.responseText); } }); } function ajaxService1() { serviceUrl = "http://localhost/WCFS/Service1.svc/GetAllPr...