I've the following WebMethod that returns a DataSet:
'A method to select all records in Eqp_For_Sale table
<WebMethod()> _
Public Function RetrieveAllFromEqp_For_Sale() As DataSet
Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("WebDB_ConnectionString").ToString)
conn.Open()
Dim comm As New SqlCommand("SELECT * FROM Eqp_For_Sale")
comm.Connection = conn
Dim da As New SqlClient.SqlDataAdapter
Dim ds As New DataSet
da.SelectCommand = comm
comm.ExecuteNonQuery()
da.Fill(ds)
conn.Close()
Return ds
End Function
I called this WebMethod from a new VB.NET application to retrieve the data, and I used the following code to retrive it into a DataGridView:
Dim a As New UsedEqpWS.UsedEqpWSSoapClient
DataGridView1.DataSource = a.RetrieveAllFromEqp_For_Sale
But the problem is when I click the button that calls these three lines, the DataGridView simply shows nothing. I tried to call the same WebMethod from a new ASP.NET Website and it working perfectly there.
Is there a way to overcome this issue?
Thanks in advance.
use
a.RetrieveAllFromEqp_For_Sale.Tables[0];