Question : web service and store procedure

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

Answer : web service and store procedure

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:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
    [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;
}
Random Solutions  
 
programming4us programming4us