Click here to Skip to main content
15,742,619 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
I wanted to ask on how to get webservice result ( i made it return value as Dataset, but it's NOT must. I might be return it as String or Datatable too if it necessary) as value in textbox (textbox.text) or label?

I have this as my webservice ( for example )
<WebMethod()> _
   Public Function AmbilBuku() As Dataset
       Dim conn As String
       conn = "server=localhost;uid=root;pwd=;database=uptbahasa"

       Dim sql As String = "Select * from buku

       Dim konek As New MySqlConnection(conn)
       Dim OdbcDa As New MySqlDataAdapter(sql, conn)
       Dim ds As New DataSet
       Return ds
   End Function

From that I return the query result as dataset, and will throw me some result like this (if I browse it through browser).

	<xs:schema id="NewDataSet">
	<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
		<xs:complexType><xs:choice minOccurs="0" maxOccurs="unbounded">
			<xs:element name="Table">
						<xs:element name="id" type="xs:int" minOccurs="0"/>
						<xs:element name="username" type="xs:string" minOccurs="0"/>
						<xs:element name="password" type="xs:string" minOccurs="0"/>
						<xs:element name="grup" type="xs:string" minOccurs="0"/>
		<Table diffgr:id="Table1" msdata:rowOrder="0">
		<Table diffgr:id="Table2" msdata:rowOrder="1">

My question is how to get for example ID and Username as textbox.text in my windows form?

Thanks a lot in advance.
Updated 5-Jun-11 19:38pm
cuteband 6-Jun-11 1:58am    
Here is the trick on this In your Strored Procedure or In your class Create an array before you return it in a string. And that will works
satrio_budidharmawan 6-Jun-11 3:55am    
How could I do that?
can u give me an example?Where should I put it?on my Webservice or Windows form?

Thanks everyone, I had it finished.

This how I do it

on the FOR LOOP I use this :

Now I facing new problem, on how to create Report in Smartdevice. The report I need is just like the result of transactions (just like in PoS software).

Anyone know?
Share this answer
return ctype(ds, dataset)

This forces it to be a dataset rather than being a diffgram dataset
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900