2012-05-11 1 views
1

내 데이터베이스에서 gridview 정보를 가져 오려고합니다. 나는 다음과 같은했지만 작동하지 않는 경우 어떻게이 방법으로 데이터 세트를 선언하는 나는 확실하지 오전 :ASP.NET 서비스 DataSet 선언

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 

namespace ConsumeDSetService 
{ 
public partial class _Default : System.Web.UI.Page 
{ 

    public class MyDataSet 
    { 
     public static DataSet ds; 
    } 

    protected void Page_Load(object sender, EventArgs e) 
    { 

    } 

    protected void Button1_Click(object sender, EventArgs e) 
    { 
     localhost.Service1 myws = new localhost.Service1(); 
     ds = myws.GetDataSet(); 
     GridView1.DataSource = ds; 
     GridView1.DataBind(); 

    } 
} 
} 

답변

0

내가이 코드는 컴파일되지 않습니다 같은데요? ds은 MyDataSet 클래스의 속성이므로

의 버튼 클릭에서 MyDataSet.ds으로 참조해야합니다.