Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hello,
my webservice stored procedure is
CREATE PROC [dbo].[GetRolesForUser](@UserID int) as
Select A.id,cast(iif(ISNULL(b.id,0)>0,1,0) as bit)  as IsChecked, A.UserRoleName
From tblRole A LEFT JOIN tblUserRoles B on (A.id=b.RoleId and B.UserID=@UserID)
 

and my client side code is:
 
vmsUri = new Uri("http://localhost:2233/iRentDataService.svc/");
            db = new iRentEntities(vmsUri);
            //var query = db.CreateQuery<GetRolesForUser_Result>("GetRolesForUser")
            //    .AddQueryOption("userid", 6);
            var query = db.Execute<GetRolesForUser_Result>(new Uri(string.Format("{0}GetRolesForUser?userid={1}", db.BaseUri, 6), UriKind.RelativeOrAbsolute));
            GetRolesForUser_Result gc = new GetRolesForUser_Result();
 
config.SetServiceOperationAccessRule("GetRolesForUser", ServiceOperationRights.All);
 
<pre lang="xml">
 
this way i exposed dataservice :
 

[WebGet]
        public IQueryable&lt;GetRolesForUser_Result&gt; GetRolesForUser(int userid)
        {
            return this.CurrentDataSource.GetRolesForUser(userid).AsQueryable &lt; GetRolesForUser_Result&gt;();
                //.GetRolesForUser(userid).AsQueryable&lt;GetRolesForUser_Result&gt;();
 

            //return this.CurrentDataSource.GetRolesForUser.where(&quot;it.userid=@userid&quot;, new ObjectParameter(&quot;userid&quot;, userid));
            //.GetRolesForUser(userid)
            //.AsQueryable();
        }
</pre>
 

The result is coming in browser :
<a href="http://localhost:2233/iRentDataService.svc/GetRolesForUser?userid=6">
how an i call at client side and bind to datagrid ..please help..thanx
Posted 6-Nov-12 2:56am

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

  Print Answers RSS
0 OriginalGriff 275
1 DamithSL 265
2 CPallini 235
3 Maciej Los 185
4 George Jonsson 170
0 OriginalGriff 5,305
1 DamithSL 4,382
2 Maciej Los 3,760
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,901


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 6 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100