dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online Membersprofit22
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » Silverlight »

Insertion of record from sl to db


Posted Date: 17 Jun 2010      Posted By:: Harikrishna     Member Level: Gold    Member Rank: 393     Points: 1   Responses: 2



hi frnz,
i have a query.
i want to insert record ie emp details into db using silverlights.
i designed 4 textbox's in sl page.xaml and if user clicks on submit button details must b send to d db.
i tried wcf etc but m unable to create object for wcf class in page.xaml.cs

plz let me knw d sol.

thanks in advance

4m
krishna




Responses

#520240    Author: Nishikant      Member Level: Gold      Member Rank: 94     Date: 23/Jun/2010   Rating: 2 out of 52 out of 5     Points: 2

Hi,

Did you add service reference to your WCF service in your SL app?

Regards,
Nishikant K

"All things are difficult before they are easy"
My Blog on Silverlight



 
#531423    Author: Harikrishna      Member Level: Gold      Member Rank: 393     Date: 26/Jul/2010   Rating: 2 out of 52 out of 5     Points: 2

This is d sol
Add WCF Service
and implement method
public bool Insert(string Name, double salary, int deptno, string address)
{
try
{
DataClassesDataContext db = new DataClassesDataContext();
Emp obj = new Emp();
obj.Name = Name;
obj.Salary = salary;
obj.deptno = deptno;
obj.address = address;
db.Emps.InsertOnSubmit(obj);
db.SubmitChanges();
return true;
}
catch
{
return false;
}
}
Add wservice reference to SL project and
in page.xaml
private void btnSubmit_Click(object sender, RoutedEventArgs e)
{


ServiceReference1.ServiceClient sc = new ServiceReference1.ServiceClient();
string Name = txtName.Text;
double Sal = Convert.ToDouble(txtSal.Text);
int deptno = Convert.ToInt32(txtdeptno.Text);
string Address = txtAddr.Text;
sc.InsertAsync(Name, Sal, deptno, Address);
sc.InsertCompleted += new EventHandler<ServiceReference1.InsertCompletedEventArgs>(sc_InsertCompleted);
}


From
Hari



 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : How .xaml file is executing ?
Previous : How to integrate googlefriendsconnect to silverlight
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.