简体   繁体   English

JSONWebService没有实现接口成员

[英]JSONWebService does not implement interface member

i encounter an error in my asp.net c# code 我在asp.net C#代码中遇到错误

here's the error 这是错误

'JSONWebService.Service1' does not implement interface member 'JSONWebService.IService1.GetAllAccountClassifications()' 'JSONWebService.Service1'未实现接口成员'JSONWebService.IService1.GetAllAccountClassifications()'

here's my code: 这是我的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Data.SqlClient;

namespace JSONWebService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : IService1
    {
        SqlConnection conn = new SqlConnection("Data Source=ASDASDASDAS1;Initial Catalog=ULIV;Persist Security Info=True;User ID=uliv_user;Password=******");

        public List<wsAccountClassification> GetAllCustomers()
        {
            ULIVDataContext dc = new ULIVDataContext();
            SqlCommand myCommand = new SqlCommand("Select * from AccountClassifications",conn );

            List<wsAccountClassification> results = new List<wsAccountClassification>();
            System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.GetCultureInfo("en-US");

            foreach (AccountClassification AcctClass in dc.AccountClassifications)
            {
                results.Add(new wsAccountClassification()
                {
                    AccountClassificationID = AcctClass.AccountClassificationID,
                    ClassificationName = AcctClass.ClassificationName,
                    ClassificationDescription = AcctClass.ClassificationDescription
                });
            }

            return results;
        }
}
}

PLEASE HELP. 请帮忙。 THANKS IN ADVANCE 提前致谢

IService1接口中定义了一个名为GetAllAccountClassifications方法。您正在实现该接口,因此您应该在类中实现IService1中定义的所有方法。由于错误,在这种情况下,您应该实现GetAllAccountClassifications方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM