Basic Web API to view data

AlHal2
AlHal2 used Ask the Experts™
on
I'm writing a basic web API.  The code below is in the values controller and should put two rows from the data table into a JSON file.
How do I amend the code, so that it produces the file?
What URLs will work?

        public DataTable Get(string EmployeeName="Joe",string EmpCode="AR")
        {

                string ConnectionString = ConfigurationManager.ConnectionStrings["WebAPIDb"].ConnectionString;
                using (SqlConnection sqlCon = new SqlConnection())
                {
                    using (SqlCommand sqlcmd = new SqlCommand())
                    {
                        using (SqlDataAdapter sqladp = new SqlDataAdapter())
                        {
                            using (DataTable dt = new DataTable())
                            {
                                sqlCon.ConnectionString = ConnectionString;
                                sqlcmd.Connection = sqlCon;
                                sqlcmd.Parameters.Clear();
                                sqlcmd.CommandType = CommandType.StoredProcedure;
                                sqlcmd.CommandText = "EmployeeTable";
                                sqlcmd.Parameters.AddWithValue("@Operation", "S");
                                sqlcmd.Parameters.AddWithValue("@FirstName", "Joe");
                                sqlcmd.Parameters.AddWithValue("@Empcode", "AR");
                                sqladp.SelectCommand = sqlcmd;
                                sqladp.Fill(dt);
                                return dt;

                            }

                        }

                    }
                }

           

        }

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial