How can I retuen a Object from a web service:
[WebMethod] public DataSet GetVendors(string Database) { SqlConnection sqlConn = new SqlConnection();
sqlConn.ConnectionString = GetConnString(Database); // build query string strSQL = @' SELECT [No_] AS [VendorNo], LTRIM([Name]) AS [VendorName] FROM [********_$Vendor] WHERE LEN(RTRIM([Name])) > 0 /* avoid blank names */ AND [Vendor Posting Group] = 'VEND' ORDER BY LTRIM([Name]) ASC; /* LTRIM fixes spaces before name */ '; SqlDataAdapter da = new SqlDataAdapter(strSQL, sqlConn); DataSet ds = new DataSet(); da.Fill(ds, 'Vendors'); return (ds); }
If I’m interpreting your question properly, populate an object on your end with your information in the
DataSetand set your return type toobject. Or just return the object you populate as that object.