Click here to Skip to main content
15,663,033 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i am implementing WCF service in that i am converting dataset to arraylist and returning when i run the proxy this menthod not invokable and it showing "!" this mark

below is my code

CSS
namespace WCFService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IService1
    {       

        [OperationContract]
        Customer GetCustomer(int id);

        // TODO: Add your service operations here
    }


    // Use a data contract as illustrated in the sample below to add composite types to service operations.
    

    [DataContract]
    public class Customer
    {
        [DataMember]
        public ArrayList GetCust
        {
            get;
            set;
        }
    }
}




C#
namespace WCFService
{
    // 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
    { 

        public Customer GetCustomer(int id)
        {
            SqlConnection con = new SqlConnection("Data Source=.;Database=Temp;Integrated Security=true");
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "Select * from tblCustomerInfo_Bangalore where CID = "+id;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            Customer cu = new Customer();
            
            ArrayList list = new ArrayList();

            foreach (DataRow row in ds.Tables[0].Rows)
            {

                list.Add(row);
            }
            cu.GetCust = list;
            return cu;

        }
        
    }
}

can any body help me out in this......



thank you.
Posted
Updated 22-Nov-12 22:45pm
v2

1 solution

Hello chetan B Y,

Try..

SqlCommand cmd = new SqlCommand(con);

in place of


SqlCommand cmd = new SqlCommand();

This may Work out for you(sorry if i'm wrong..)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900