2
Answers

display list of customers

aida athamnia

aida athamnia

14y
1.9k
1
Hi,
i want to display list of customers in my database but an error has occured , please help me

error:

'ClientServiceLibrary.ClientTopNet' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'ClientServiceLibrary.ClientTopNet' could be found (are you missing a using directive or an assembly reference?)

and there is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data;

namespace ClientServiceLibrary
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]

    public class ClientTopNetService  :  IClientTopNetService
    {

        #region IClientTopNetService Membres

        public ClientTopNet ConsultationClient(int ID_CLIENT)
        {
            System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
            conn.ConnectionString = @"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=topnet;Initial Catalog=TopnetBase;Data Source=SWEET-4B6F892B4\SQLEXPRESS";
            ClientTopNet oClients = new ClientTopNet();
            System.Data.OleDb.OleDbDataReader rs;
            System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from client  where ID_CLIENT='"+ID_CLIENT+"'", conn);
            rs = comm.ExecuteReader();
            while (rs.Read())
            {
                ClientTopNet oClient = new ClientTopNet(); 
                oClient.LOGIN_CREATION = rs["LOGIN_CREATION"].ToString();
                oClient.NOM = rs["NOM"].ToString();
                oClient.ADRESSE= rs["ADRESSE"].ToString();

                oClients.Add(oClient);
              
                return oClients;


            }
}


Answers (2)