The problem is getting the data in my dataGridView from my web service. When I call the getList method from webservice, I get the correct xml code. This is my code: web service:
[WebMethod]
public DataSet getList()
{
SqlConnection connection = new SqlConnection();
connection.ConnectionString = "server=localhost;" +
"Trusted_Connection=yes;" +
"database=oving1; " +
"connection timeout=30";
string select = "select * from Person";
SqlDataAdapter da = new SqlDataAdapter(select, connection);
DataSet ds = new DataSet();
da.Fill(ds, "Person");
return (ds);
}
the form:
private void button1_Click(object sender, EventArgs e)
{
Service1 webService = new Service1();
DataSet ds = webService.getList();
dataGridView1.DataSource = ds;
}
source
share