c# - Connect Windows Store Apps to SQL Server Database Using WCF -
hello trying connect windows store app sql server database using wcf middle-ware. able successfully. not able insert valuses database. please can me this?
here code:
this mainpage.xaml
<page x:class="windowsstoretosql.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:windowsstoretosql" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d"> <grid background="{staticresource applicationpagebackgroundthemebrush}" rendertransformorigin="0.508,0.484"> <textbox horizontalalignment="left" name="idtextbox" textwrapping="wrap" text="" verticalalignment="top" margin="108,162,0,0" width="246"/> <textbox horizontalalignment="left" name="nametextbox" textwrapping="wrap" text="" verticalalignment="top" margin="762,162,0,0" width="246"/> <textbox horizontalalignment="left" name="agetextbox" textwrapping="wrap" text="" verticalalignment="top" margin="762,314,0,0" width="246"/> <textbox horizontalalignment="left" name="gendertextbox" textwrapping="wrap" text="" verticalalignment="top" margin="108,314,0,0" width="246"/> <textbox horizontalalignment="left" name="emailtextbox" textwrapping="wrap" text="" verticalalignment="top" margin="762,241,0,0" width="246"/> <textbox horizontalalignment="left" name="passwordtextbox" textwrapping="wrap" text="" verticalalignment="top" margin="108,241,0,0" width="246"/> <button content="showdata" name="showdata" horizontalalignment="left" verticalalignment="top" margin="590,422,0,0" click="showdata_click"/> <button content="insertdata" name="insertdata" horizontalalignment="left" verticalalignment="top" margin="352,422,0,0" click="insertdata_click"/> <gridview horizontalalignment="left" name="empgridview" verticalalignment="top" width="150" margin="646,162,0,0" grid.column="1" /> </grid> </page>
this mainpage.xaml.cs:
using system; using system.collections.generic; using system.io; using system.linq; using windows.foundation; using windows.foundation.collections; using windows.ui.xaml; using windows.ui.xaml.controls; using windows.ui.xaml.controls.primitives; using windows.ui.xaml.data; using windows.ui.xaml.input; using windows.ui.xaml.media; using windows.ui.xaml.navigation; using windows.ui.popups; namespace windowsstoretosql { public sealed partial class mainpage : page { app2.servicereference1.service1client myservice; public mainpage() { this.initializecomponent(); } protected override void onnavigatedto(navigationeventargs e) { myservice = new app2.servicereference1.service1client(); } private async void insertdata_click(object sender, routedeventargs e) { await myservice.insertemployeeasync(new app2.servicereference1.employee() {empid = convert.toint32(idtextbox.text), empname = nametextbox.text, empage = agetextbox.text, empgender = gendertextbox.text, empemail = emailtextbox.text, emppassword = passwordtextbox.text }); } private async void showdata_click(object sender, routedeventargs e) { var emplist = await myservice.getemployeeasync(); foreach (var emp in emplist) { gridviewitem empview = new gridviewitem(); stackpanel spanel = new stackpanel(); spanel.children.add(new textblock() { text = convert.tostring(emp.empid) }); spanel.children.add(new textbox() { text = emp.empname }); spanel.children.add(new textblock() { text = emp.empage }); spanel.children.add(new textblock() { text = emp.empgender }); spanel.children.add(new textbox() { text = emp.empemail }); spanel.children.add(new textblock() { text = emp.emppassword }); empview.content = spanel; empgridview.items.add(empview); } } } }
my problem:
at line:
await myservice.insertemployeeasync(new app2.servicereference1.employee() { empid = convert.toint32(idtextbox.text), empname = nametextbox.text, empage = agetextbox.text, empgender = gendertextbox.text, empemail = emailtextbox.text, emppassword = passwordtextbox.text });
i getting endpointnotfound exception :
> there no endpoint listening @ > http://localhostname/design_time_addresses/wcfservicelibrary1/service1/ > accept message. caused incorrect > address or soap action. see innerexception, if present, more > details.
i not able resolve this. can please me this?
thank you.
Comments
Post a Comment