Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

How to write a Web Service that returns a recordset according to criteria with type of both: JSON and XML?

$
0
0

I have 3 separate SQL Server tables: Compensation, Grant, and Compensation Grant.

What I want is according to the first parameter passed to the web service of type integer(1 for Compensation, 2 for Grant, 3 for Compensation Grant), and the second parameter of type integer that specifies the year/month (for example 201905 for May, 2019), I will select all records from the table specified where the field="201905")

For example:

if TableType="Compensation" then

Select fields(A,B,C) FROM [Compensation] WHERE D=201905

if TableType="Grant" then

Select fields(A,B,C) FROM [Grant] WHERE D=201905

if TableType="Compensation Grant" then

Select fields(A,B,C) FROM [CompensationGrant] WHERE D=201905

So How to write the whole Web Service that returns data for both: JSON and XML?


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>