using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.Services;
using System.Web.Configuration;
using System.Data.SqlClient;
namespace WebService1
{
/// <summary>
/// Summary description for Service1
/// </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 Service1 : System.Web.Services.WebService
{
string str1 = WebConfigurationManager.ConnectionStrings["sql1"].ConnectionString;
SqlDataAdapter da;
public WebService1()
{
}
public DataSet xx()
{
SqlConnection conn = new SqlConnection(str1);
string sql = "select STANDARD_UI,ROLE_ID from Test";
conn.Open();
da = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
da.Fill(ds);
conn.Close();
return ds;
}
}}
in aspx.cs
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int a;
Product.Service1 ProductsService = new Product.Service1();
GridView1.DataSource =
ProductsService.xx(12); GridView1.DataBind();
}
}
i m getting error in calling the method xx.. can yu pls help me