Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8821681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:55:02+00:00 2026-06-14T05:55:02+00:00

I’m new to wcf and rest operations so any help would be great thank

  • 0

I’m new to wcf and rest operations so any help would be great thank you.

How do i display information in a rdlc or a datagridview?

My Interface set up operation contract with a method called GetAllCustomer

namespace ConnectionToDatabase
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IGetCustomer" in both code and config file together.
    [ServiceContract]
    public interface IGetCustomer
    {
        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Xml,
            BodyStyle = WebMessageBodyStyle.Wrapped,
            UriTemplate = "xml/customers")]        
        List<Customer> GetAllCustomer();
    }
}

My customer class which implements interface class
and connects to a sql database and returns a list of customer info

public class GetCustomer : IGetCustomer
    {
        public List<Customer> GetAllCustomer()
        {
            List<Customer> mylist = new List<Customer>();

            using (SqlConnection conn = new SqlConnection("Data Source=MATRIX\;Initial Catalog=******;Integrated Security=True"))
            {
                conn.Open();

                string cmdStr = String.Format("select * from CInformation c inner join EmploymentInformation e on c.CID = e.CID");
                SqlCommand cmd = new SqlCommand(cmdStr, conn);
                SqlDataReader rd = cmd.ExecuteReader();

                if (rd.HasRows)
                {
                    while (rd.Read())
                    {
                        mylist.Add(new Customer(rd["LastName"].ToString(), rd["FirstName"].ToString(), rd["MiddleName"].ToString(), rd["EmailAddress"].ToString(), rd["PhoneNumber"]));
                    }
                }
                conn.Close();
            }

            return mylist;
        }
    }

    [DataContract]
    public class Customer
    {
        [DataMember]
        public string lastname { get; set; }
        [DataMember]
        public string firstname { get; set; }
        [DataMember]
        public string middlename { get; set; }
        [DataMember]
        public string emailaddress { get; set; }
        [DataMember]
        public string phonenumber { get; set; }            
        public Customer(string last, string first, string middle, string email, string phone)
        {
            this.lastname = last;
            this.firstname = first;
            this.middlename = middle;
            this.emailaddress = email;
            this.phonenumber = phone;                
        }


    }//end of class

web config

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>

    <services>
      <service name="ConnectionToDatabase.GetCustomer" behaviorConfiguration="EmpServiceBehaviour">
        <endpoint address ="" binding="webHttpBinding" contract="ConnectionToDatabase.IGetCustomer" behaviorConfiguration="web">
        </endpoint>
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="EmpServiceBehaviour">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

windows form app

public Form1()
{
    InitializeComponent();
}

private void btnGetAllCustomers_Click(object sender, EventArgs e)
{
 WebRequest request = WebRequest.Create("http://localhost:52420/GetCustomer.svc/xml/customers");
        WebResponse ws = request.GetResponse();

        StreamReader responseStream = new StreamReader(ws.GetResponseStream());
        string response = responseStream.ReadLine();
        responseStream.Close();   
        textBox1.AppendText(response);
}  

right now it looks like this

in a textbox

<GetAllCustomerResponse xmlns="http://tempuri.org/"><GetAllCustomerResult xmlns:a="http://schemas.datacontract.org/2004/07/ConnectionToDatabase" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:Customer><a:firstname>Dog</a:firstname><a:lastname>Cat</a:lastname><a:middlename>up</a:middlename></a:Customer></GetAllCustomerResult></GetAllCustomerResponse>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:55:03+00:00Added an answer on June 14, 2026 at 5:55 am

    You nee to like this

        using (nServiceReferenceCustomers.GetCustomerClient svc = new ServiceReferenceCustomers.GetCustomerClient())
        {
            XmlNode node = svc.GetAllCustomer();
            DataSet ds = new DataSet();
            using (XmlNodeReader reader = new XmlNodeReader(node))
            {
                ds.ReadXml(reader);
            }
    
    
            DataTable table = ds.Tables["Table"];
            DataRow row = table.Rows[0];
            string Lastname= (string) row["lastname"];
            string Firstname= (string) row["firstname"];
            string Middlename= (string) row["middlename "];
    string email= (string) row["emailaddress"];
    string Phone= (string) row["phonenumber"];
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a view passing on information from a database: def serve_article(request, id): served_article

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.