Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2003

Tip: Looking for answers? Try searching our database.

Perameterized Query on webservice?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Nihan - 23 Nov 2003 23:13 GMT
I've created the following distributed application:

Solution

EDSQLWSVC EDEmployerWinClient Project3
Web Service winform app asp.net web app

My web services are fine....and I can get data in, out etc. My problem is
this:
I want to use the data adaptors in the web services for the windows client
application. Only problem is...when i want to run a parameterized query in
the client application...I get errors flagging the SQL Statement and the
Parameterization. Big ones. SO...How do I parameterize the query? I've done
it in the Data Adaptor's SQL Statement in the web service, and on the
windows form, I've tried:

Private Sub GetRecs_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GetRecs.Click
Dim ws As New EDEmployerWinClient.EDEmployerService.EmpService
ws.Credentials = System.Net.CredentialCache.DefaultCredentials
EmpRecData.SelectCommand.Parameters("Param1").Value = Textbox1.Text
EmpRecsDa1.Clear()
EmpRecsDa1.Fill(EmpRecsData)
EmpRecsData.Merge(ws.GetRecs())
End Sub

EDEmployerService is the web reference, and EmpService is the Web Service

All I want it to do is to Select only the records based on the Parameter. In
my SQL Statement, I have "SELECT Tbl_One.* FROM Tbl_One WHERE Email =
@Param1"

This is my first time trying to parameterize a SQL Statement through web
services..so I'm a bit lost. Any ideas where someone's done something
similar?
Saurabh Nandu - 29 Nov 2003 06:36 GMT
Hi,
Assuming, EmpRecData is your dataset, the following code will not work
because,

> EmpRecData.SelectCommand.Parameters("Param1").Value = Textbox1.Text

SelectCommand is a property of DataAdapter and it must be set on a
DataAdapter like

EmpRecsDA1.SelectCommand.Parameters("Param1").Value = Textbox1.Text

Regards
Akila
[MVP|MCAD]

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.