web services - Linq data fetch in wcf test client -
here query :
select * menu
i using wcf web services , have created local database.
i want return data using linq , show table's data in wcf client.
can me function?
here code :
namespace crossdine { // note: can use "rename" command on "refactor" menu change class name "service1" in code, svc , config file together. // note: in order launch wcf test client testing service, please select service1.svc or service1.svc.cs @ solution explorer , start debugging. public class service1 : iservice1 { string connectionstring = ...; sqlconnection con = new sqlconnection(connectionstring); public string getdata(int value) { return string.format("you entered: {0}", value); } public compositetype getdatausingdatacontract(compositetype composite) { if (composite == null) { throw new argumentnullexception("composite"); } if (composite.boolvalue) { composite.stringvalue += "suffix"; } return composite; } public datatable getmenu() { datatable datatab = null; sqlcommand cmd = new sqlcommand("select * menu",con); con.open(); sqldataadapter da = new sqldataadapter(cmd); da.fill(datatab); return datatab; } } }
here instead of datatable want use linq return data.
Comments
Post a Comment