i had maked a webservice in which getleger function is maked like this :
public List<datalist7> getleger(string accno, string fromdate, string todate)
{
SqlConnection con = new SqlConnection(@"Data Source=saba-PC;Initial Catalog=bcounts;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("select gt.Value_Date,gt.Voucher_no+'-'+gr.VchrType as voucher,gt.Acct_Nirration,gr.InstrumentNo,gt.Dr_Amount,gt.Cr_Amount from gl_transaction gt, Gl_Ref gr where gt.Accountno = '" + accno + "' and gt.Voucher_No=gr.Voucher_no and gt.Value_Date between '" + fromdate + "' and '" + todate + "'", con);
SqlDataReader rdr = cmd.ExecuteReader();
decimal crsum = 0;
decimal drsum = 0;
decimal balance = 0;
List<datalist7> data = new List<datalist7>();
if (rdr.HasRows)
{
while (rdr.Read())
{
if (rdr.GetDecimal(4) > 0)
{
balance = balance + rdr.GetDecimal(4);
drsum += rdr.GetDecimal(4);
data.Add(new datalist7(rdr.GetDateTime(0).ToShortDateString(), rdr.GetString(1), rdr.GetString(2), rdr.GetString(3), rdr.GetDecimal(4).ToString(), "-", balance.ToString()));
}
else
{
balance = balance - rdr.GetDecimal(5);
crsum += rdr.GetDecimal(5);
data.Add(new datalist7(rdr.GetDateTime(0).ToShortDateString(), rdr.GetString(1), rdr.GetString(2), rdr.GetString(3), "-", rdr.GetDecimal(5).ToString(), balance.ToString()));
}
}
data.Add(new datalist7("-", "-", "-", "-", drsum.ToString(), crsum.ToString(), "-"));
}
con.Close();
return data;
}
and in Service1.cs file
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "getleger/accno={accno}&fromdate={fromdate}&todate={todate}")]
List<datalist7> getleger(string accno, string fromdate, string todate);
but whenever i called this method on browser like this
http://localhost:49609/ipadservice.svc/getleger/0010010010006/2013-02-01/2014-02-01
it shows :
Endpoint not found. Please see the service help page for constructing valid requests to the service.
what was the matter?