Solved

web service and store procedure

Posted on 2010-08-17
5
477 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

15 Experts available now in Live!

Get 1:1 Help Now