Solved

web service and store procedure

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 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