c# - Webmethod returning nothing in webservice -
i new webservice thing, trying in below pass variable in method , data sql different tables in class...but when run code, don't see webmethod...any appreciated..sooner better stuck , have deliver tomorrow...
namespace webdata { public class data : system.web.services.webservice { class record { public char descrptn_104 { get; set; } public char pmdes_01 { get; set; } public char prtnum_10 { get; set; } public char ordref_10 { get; set; } public datetime tnxdte_01 { get; set; } [webmethod] static list<record> getdata(string ordnum_10) { sqlconnection con = new sqlconnection(@"data source=****;initial catalog=******;integrated security=true;"); con.open(); sqlcommand cmd = new sqlcommand("select distinct account_types.descrptn_104, part_master.pmdes1_01,order_master.prtnum_10,order_master.ordnum_10,order_master.ordref_10,part_master.tnxdte_01 (****.dbo.order_master order_master left outer join ****.dbo.part_master part_master on order_master.prtnum_10=part_master.prtnum_01) left outer join ****.dbo.account_types account_types on part_master.acttyp_01=account_types.acttyp_104 order_master.ordnum_10 = '" + ordnum_10 + "'", con); sqldatareader dr = cmd.executereader(); list<record> records = new list<record>(); while (dr.read()) { records.add(new record() { descrptn_104 = dr.getchar(0), pmdes_01 = dr.getchar(1), prtnum_10 = dr.getchar(2), ordref_10 = dr.getchar(3), tnxdte_01 = dr.getdatetime(4) }); } dr.close(); con.close(); return records; }} } }
if "run code", mean query service actions implements, "returns nothing", mean service claims doesn't have any, , code posted code you're trying compile, i'm guessing don't see webmethod because didn't specify accessibility level method, , default private. webmethods should public.
Comments
Post a Comment