Web Service and Windows CE

  • Thread starter Thread starter Shannon Ramirez
  • Start date Start date
S

Shannon Ramirez

I have a web service that access sql server. From the CE, I'd like to
reference that web service to gain access to the sql data. I've
created the web service and written a little vb client app to test
that it is working and learn how to do that. Now I'd like to use the
web service and access it with the ce. In the vb client app I used
grid.datasource =
and grid.datamember =
to access teh web service. This doesn't work with the CE. it looks
liek there is no datamember.

Can someone give me some pointers as to what I am doing wrong and also
any web sites that they know of. I'm pretty new to this, but do have
this all workikng in my vb client.

thanks
shannon
 
Are you talking about .NET (a .NET-WebService and a
..NET-CF-clientapplication)?

What is the return-value of your WebService? .NET-DataSet?

D.Barisch
 
The web service is a .Net webservice running on my desktop IIS server.
The client is the .NET CF.

The selected value from the web service is a name.. say like John. Like
mentioned before, I can get the selected.item, just not the value.. at
least not without having to go to the datarow to get it.

Do you have any ideas.
thanks
shannon
 
| The selected value from the web service is a name.. say like John. Like
| mentioned before, I can get the selected.item, just not the value.. at
| least not without having to go to the datarow to get it.

I do not really understand what you are trying to do. Maybe you could
explain it a little more.

Your WebService looks like

<WebMethod>
Public Function ReturnValue() As String
Dim myValue As String
...
Return myValue
End Function

right?

Did you add a WebReference to the WebService in your client-application?

What do you mean with "selected.item"? Do you try to show a string within a
DataGrid or a Listbox, ...?

D.Barisch
 
sorry about that.. I'll try to explain better.

I have a webservice that is returning a dataset. In the client side, I
have a list box that is using the web service to return a list of names.
That much is working great.

when not in a CF.Net env, with a listbox if I do a
listbox.selectedValue, i get back the value that is displayed in the
listbox. if I do a listbox.selecteditem I get back the primary key
value I put in the valuemember.

In the CF.Net env, if I do a selectedvalue, I don't get anything back.
The selecteditem give me the key value, but nothing in the
selectedvalue. I was wondering why that is. I got a tip from a web
site on how I canuse a datarow to get the info I'm after, just wondering
if I'm doing something wrong with teh selectedvalue.

hope that makes more sense.
thanks

JvCoach23
Sql Vet
.NET Rookie
 
| hope that makes more sense.
| thanks
yes, much more sense...
thank you too

| In the CF.Net env, if I do a selectedvalue, I don't get anything back.
| The selecteditem give me the key value, but nothing in the
| selectedvalue. I was wondering why that is. I got a tip from a web
| site on how I canuse a datarow to get the info I'm after, just wondering
| if I'm doing something wrong with teh selectedvalue.

What did you set to ListBox.DataSource? The DataSet or a specific DataTable.
As far as I remember the CF-controls can't handle DataSets as DataSource.
And I think, somewhere I've read that in a CF-ListBox you can either use
SelectedItem (unbounded mode) OR SelectedValue (bounded mode). But I'm not
sure about it!
So I guess, maybe setting the DataSource does not work in your code and the
ListBox stays in unbounded-mode. That's why SelectedValue returns nothing.

But as I said, I don't know exactly. I do not use them in bounded mode. I
prefer filling the ListBox manually with the 'display-member' and storing
the 'value-members' within a separate ListDictionary. After selecting a
ListBoxItem I can get the value with ListDictionary(Listbox.SelectedItem).

| NET Rookie
brave statement, respect

D.Barisch,
NET Rookie with a little practise
 
I prefer filling the ListBox manually with the 'display-member' and
storing the 'value-members' within a separate ListDictionary.

how do you do that..

Here is my code.. thanks for the help so far.

Dim objService As New InvTrxAssortment.Service1

Dim objds1 As New DataSet
objds1 = objService.GetEmployeeList

With Me.ListBox2
.DataSource = objds1.Tables("EmployeeList")
.DisplayMember = "vcFirstName"
.ValueMember = "intTblEmployeeId"
End With



JvCoach23
Sql Vet
.NET Rookie
 
| With Me.ListBox2
| .DataSource = objds1.Tables("EmployeeList")
| .DisplayMember = "vcFirstName"
| .ValueMember = "intTblEmployeeId"
| End With

Maybe the problem is, that for the ListBox DataRow.Item("vcFirstName") is
not an accessible Property. I think the CF-ListBox only can handle 'real'
properties like Employee.FirstName. Maybe you could write sth. like a
'wrapper'-class that reads the DataRow into (a list of) an own class and use
that one as DataSource.

| >> I prefer filling the ListBox manually with the 'display-member' and
| storing the 'value-members' within a separate ListDictionary.
|
| how do you do that..

private pList as new ListDictionary

sub FillList()
Dim objds1 As New DataSet = objService.GetEmployeeList

dim pRow as DataRow
for each pRow in objds1.Tables("EmployeeList").Rows
Me.ListBox2.Items.Add(pRow("vcFirstName"))
pList.Add(pRow("vcFirstName"), pRow("intTblEmployeeId"))
next pRow
end sub

sub ListBox2_SelectedIndexChanged(...) handles ...
msgbox pList(ListBox2.SelectedItem)
end sub

I hope that works, I didn't test it now. You could also use a simple
ArrayList and get the EmployeeId by refering to the SelectedIndex of the
ListBox. But don't use sth. like HashTable, because it resorts the items on
adding, so the order whould be different in the ListBox and in your
Collection.

D.Barisch
 
Back
Top