Solved

web service and store procedure

Posted on 2010-08-17
5
478 Views
Last Modified: 2012-05-10
Hi experts. i have this store procedure

create procedure [certifica].[ObtenerCodigoCurso]
   @abreviatura varchar(10)
as
select
         C.CODCURSO,
         C.NOMBRECURSO,
         C.FECHAINICIOCURSO,
         C.FECHAFINCURSO,
         C.NOMBRESEDE,
       C.NUMERORESOLUCION,
       C.CODTIPOCALIFICATIVO
from  intranetamag.CURSO C
where C.ABREVIATURA = @abreviatura

I do consume a web service that this store procedure, please help
I am working with Microsoft Visual Studio 2008
0
Comment
Question by:enrique_aeo
  • 3
5 Comments
 
LVL 8

Accepted Solution

by:
Yiogi earned 250 total points
ID: 33460436
What are you trying to do? Return an xml dataset based on your stored procedure from your service? Then it's as simple as this:


    [WebMethod]
    public DataSet GetSPData() {
        SqlConnection con;
        SqlCommand cmd;
        SqlDataAdapter adpt;
        DataSet ds = new DataSet();
        string SP = "certifica.ObtenerCodigoCurso";
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["YourConnectionString"].ConnectionString);
        cmd = new SqlCommand(SP, con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@abreviatura ", SqlDbType.NVarChar, 10).Value = "PARAMVALUE";
        adpt = new SqlDataAdapter(cmd);
        con.Open();
        adpt.Fill(ds);
        con.Close();
        return ds;
}

Open in new window

0
 

Author Comment

by:enrique_aeo
ID: 33464762
ok, that part is fine, but I need something like a hands on lab to create the web services
0
 
LVL 22

Assisted Solution

by:Om Prakash
Om Prakash earned 250 total points
ID: 33472424
0
 

Author Comment

by:enrique_aeo
ID: 33473584
i am loooking like that
http://blogs.microsoft.co.il/blogs/bursteg/archive/2008/02/10/how-to-build-an-n-tier-application-with-wcf-and-datasets-in-visual-studio-2008.aspx,
but on web services
that is, showing how to use visual studio 2008 to make a complete solution (create the service and consume it from a web application), I buscao and can not find, that is why I turn to you
0
 

Author Comment

by:enrique_aeo
ID: 33489439
In Solution Explorer, right-click Solution 'AdventureWorksSite', point to Add,
and then click New Project.
2. In the Add New Project dialog box, create an ASP.NET Web Service
Application project with the following properties:
• Project types: Visual C# or Visual Basic.
• Name: ReviewsWebService
3. In Solution Explorer, right-click Service1.asmx, and then rename it to
Reviews.asmx.
4. Open the Reviews.asmx file in Code view.
5. In the Reviews.asmx.cs or Reviews.asmx.vb file, change the name of the class
from Service1 to Reviews.
6. View the markup of the Reviews.asmx file.
7. In the @ WebService directive, change the class attribute to
ReviewsWebService.Reviews.
8. Save your changes.

-put code

Test the GetReviews XML Web service method
1. Build the ReviewsWebService.
2. View the Reviews.asmx page in the browser.
The description page of the XML Web service is displayed. Note the
description information for the Web service and Web method.
3. In the browser, click GetReviews.
4. In the productID box, type 709 and then click Invoke.
The browser displays the XML response from the XML Web service.
5. Close both browser windows.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now