VS.net Walkthroughs / Data access in Distributed App?

S

Steve Nihan

I've been following a solution in the VS.net walkthroughs, and have come up
on a wall.
I have a solution with three projects in it. One is a web service, with
perameterized SQL Adapters, Another is a asp.net web app, and the other is
the windows form client app. The problem I'm having is trying to
perameterize the SQL statement from the winform client app. I've added the
web reference to the SQL adapter, and everything basically shows up ok.
What I can't do is perameterize the query. I'm trying to get a set of
records back based on an id, so in the SQL data adapter in the web service,
I have:

SELECT Tbl_Emp.*
FROM Tbl_Emp
WHERE id = @Param1


I can preview the data with the perameter, and enter it manually from the
web service page, likewise, I can leave the client winform and web service
data adapter's SQL statement UNPERAMETERIZED, and can get results, but when
I try to add perameterization in the web service data adapters SQL
statement, and in the winform client page, I get errors. Currently, in the
winform client page:

Private Sub GetRecs_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GetRecs.Click
Dim ws As New EDEmployerWinClient.EDEmpWsvc.EmpService
ws.Credentials = System.Net.CredentialCache.DefaultCredentials
EmpRecsDa1.SelectCommand.Parameters("EmpID").Value = TextBox1.Text
'1st line I'm having problems with
EmpRecsDa1.Fill(EmpRecsDs1)
'this is the second line I'm having problems with
EmpRecsDs1.Clear()
EmpRecsDs1.Merge(ws.GetRecs())
End Sub

By calling EmpRecsDa1 from the webservice and looking at the code in vs.net,
it's telling me that EmpRecsDa1 isn't Declared.

Should I be calling the data adapter from the web service, the dataset from
the web service? I've added a data adapter to the form itself and called it
EmpRecsData, but I'm getting a similar problem saying that SelectCommand and
Fill are not members of the web service's dataset.

Any help would be great,...as I can't find anything else on this in the
MSDN. It looks like nobody's been working on anything similar, which is
strange. Microsoft made such a fuss about creating distributed applications
using web services...I thought this might be a common problem.
 
S

Steve Nihan

Sorry.....Comments apply to the previous lines of code. (Each of the
EmpRecsDa1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top