on the server:
using System.Web.Services;
using System.EnterpriseServices;
[WebMethod(TransactionOption=TransactionOption.RequiresNew)]
public DataSet GetData()
{
Trace.Write("Hello ....");
TraceSwitch tsInfo = new TraceSwitch("acctInfo", "Info traces");
tsInfo.Level = TraceLevel.Verbose;
Trace.WriteLineIf(tsInfo.TraceVerbose, "XYZ");
// Trace.WriteLineIf(tsInfo.Level > TraceLevel.Warning, "AAAA");
this.sqlDataAdapter1.Fill(this.dataSet11);
return dataSet11;
}
[WebMethod(EnableSession=true, MessageName="GetNo1")]
public int GetNo()
{
Session["No"] = (int)Session["No"] + 1;
return (int)Session["No"];
}
[WebMethod(EnableSession=true, MessageName="GetNoN")]
public int GetNo(int n)
{
Session["No"] = (int)Session["No"] + n;
return (int)Session["No"];
}
on the global.asax.cs
protected void Session_Start(Object sender, EventArgs e)
{
Session["No"] = 0;
}
----------------------------------------------
if you want to enable the transaction
WebMethod(TransactionOption=TransactionOption.RequiresNew