开发者

how to get data through a stored procedure in wcf?

I am working on a wcf application where i want to access some columns from a table (prefebly via stored procedure) through wcf and pass it to client. I have searched a lot on the google but unable to find a good example of it. Can开发者_如何学编程 some one help me please.

Thanks in advance


Any of the DB APIs will allow you access to SQL. Recently, I've used mostly the Entity Frameworks with my WCF services. All was fine and dandy, once you get the connection string(s) worked out to each of your databases.


erm write a datacontract serializable class and have a method on it to populate itself using a connection object?


Make sure your types are serializable. Based on your comment to PeanutPower's answer it looks like you'll need to make sure TBL_CONTENTTEMPLATE is serializable. Also verify you have your service contract defined on the client side to accept a collection type of System.Collections.Generic.List, the default is System.Array and I've run into problems in the past when the client contract was misconfigured in this way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜