public class SqlSelect : linterface { private static readonly string SlectShitu = "select * from shitu where c_num>60 and z_name='dotnet' order by s_id"; public SqlDataReader SelectData() { SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["constring"]); SqlCommand cmd = new SqlCommand(SlectShitu, con); SqlDataReader sda = null; try { con.Open(); sda = cmd.ExecuteReader(CommandBehavior.CloseConnection); } catch(SqlException ex) { throw new Exception(ex.Message,ex); } return sda; } }
//linterface.cs public interface linterface { SqlDataReader SelectData(); }