using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Web.Configuration;

namespace ResMangSys
{
    public class GetList
    {
        public static string connString = WebConfigurationManager.ConnectionStrings["ResMangConnectionString"].ConnectionString;
        public static string[] GetDataList(string sqlString,string argName)
        {
            SqlConnection conn;
            SqlCommand cmd;
            //string cmdString = "select top 10 BaStaName from T_NetResLedg where BaStaName like '%" + prefixText + "%'";
            //string cmdString = sqlString;
            conn = new SqlConnection(connString);
            cmd = new SqlCommand(sqlString, conn);
            conn.Open();
            SqlDataReader myReader;
            List<string> returnData = new List<string>();
            myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            while (myReader.Read())
            {
                returnData.Add(myReader[argName].ToString());
            }
            return returnData.ToArray();
        }
    }
}