Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 SQL-Server-2008 C#4.0 , +
I have created an web service, through which i interact with database.
 
I have desktop application done in c#, and i want to call web method for insert,update,delete and selecting data using web service...
 

Please Help me....!!!
Posted 16-Aug-11 0:08am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Steps to create Web service:
 
1. Create a Web service application
2. In Solution Explorer, right-click the .asmx file and choose View Code.
3. Create a Web service method that does addition
 
[WebMethod]
public int WebAdd(int x, int y)
{
   return x + y;
}
 
To call an XML Web service synchronously
 
1. Create a new Windows-based application
2. In Solution Explorer, right-click the References node of the project, and then click Add Web Reference. The Add Web Reference dialog box opens.
3. Type the following Web Service URI in the Address box
http://localhost/WebService1/Service1.asm[^]
4. This is the URI of the Web Service you created in the previous procedure. The WebAdd and WebMultiply Web methods appear in the left pane of the Add Web Reference dialog box.
5.Add the code in Codebehind file
 
private void button1_Click(object sender, System.EventArgs e)
{
// Create instances of the operands and result.
   int x, y, z;
// Parse the contents of the text boxes into integers.
   x = int.Parse(textBox1.Text);
   y = int.Parse(textBox2.Text);
// Call the WebAdd Web service method from the instance of the Web service.
   z = MathServiceClass.WebAdd(x, y);
   textBox3.Text = z.ToString();
}
 
Run the application
 
Hope this helps.
 
Senthil S
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Just add service reference, and use the generated proxy class.
 
http://stackoverflow.com/questions/621440/calling-asp-net-web-service-from-c-application[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 275
1 Maciej Los 204
2 Sergey Alexandrovich Kryukov 200
3 King Fisher 185
4 OriginalGriff 183
0 OriginalGriff 6,223
1 DamithSL 4,724
2 Maciej Los 4,196
3 Kornfeld Eliyahu Peter 3,894
4 Sergey Alexandrovich Kryukov 3,496


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 18 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100