Está en la página 1de 2

using System;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;

namespace ServiciosWebGoodReadsDB
{
/// <summary>
/// Summary description for Autor
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX,
uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Autor : System.Web.Services.WebService
{

[WebMethod]
public string HelloWorld()
{
return "Hello World";
}

[WebMethod]
public DataSet ConsultaAutor()
{
string

cadena = "Data Source=DESKTOP-EMCBGVV; Initial Catalog


=goodReadsDB; Integrated Security= true; User ID =''; Password=''";

SqlConnection con = new SqlConnection(cadena);


con.Open();
//SqlDataAdapter ad = new SqlDataAdapter("select opcion,
link_opcion from autor", con);

SqlCommand cmd = new


SqlCommand("sp_consultar_autor_por_nombre", con);
SqlDataAdapter ad = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
ad.Fill(ds);
return ds;
}
}
}

También podría gustarte