Dinesh Elumalai

Dinesh Elumalai

  • NA
  • 2
  • 1.2k

inconsistent accessibility

Jan 17 2018 7:33 AM
inconsistent accessibility ;return type getuser is less accessible than method Service1. users -- how to rectify this error
 
Service1.cs
 
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace wcfdocsys
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
public class Service1 : IService1
{
SqlConnection con;
SqlCommand com;
SqlConnectionStringBuilder constr;
void connect()
{
constr = new SqlConnectionStringBuilder();
constr.DataSource = "HP-PC\\SQLEXPRESS";
constr.InitialCatalog = "DocSystem";
constr.Encrypt = true;
constr.TrustServerCertificate = true;
constr.ConnectTimeout = 30;
constr.AsynchronousProcessing = true;
constr.MultipleActiveResultSets = true;
constr.IntegratedSecurity = true;
con = new SqlConnection(constr.ToString());
com = con.CreateCommand();
}
public getuser users() //this is showing error
{
getuser getuser = new getuser();
try
{
com.CommandText = "Select * from tblUser_stg";
com.CommandType = CommandType.Text;
con.Open();
SqlDataReader rd = com.ExecuteReader();
while (rd.Read())
{
getuser.slno = Convert.ToInt32(rd[0]);
getuser.UserID = rd[1].ToString();
getuser.UserName = rd[2].ToString();
getuser.Password = rd[3].ToString();
getuser.ForceChangePassword = Convert.ToBoolean(rd[4]);
getuser.RoleID = Convert.ToInt32(rd[5]);
getuser.isActive = Convert.ToBoolean(rd[6]);
}
return getuser;
}
catch (Exception)
{
throw;
}
finally
{
if (con != null)
{
con.Close();
}
}
}
}
}
 
IService1.cs
[OperationContract]
getuser users(); //it also shows same error

Answers (1)