Files
Groupware/SubProject/FEQ0000/DataBaseManager.cs
chikyun.kim a873717126 장비관리를 별도의 프로젝트로 분리 -
개별 프로젝트 참조를 위한 뼈대 생성 - 공용은 fcommon 으로 이 관
2018-09-17 15:42:20 +09:00

37 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FEQ0000
{
public static class DatabaseManager
{
private static System.Data.SqlClient.SqlConnection getCn()
{
string cs = Properties.Settings.Default.gwcs;
System.Data.SqlClient.SqlConnection cn = new System.Data.SqlClient.SqlConnection();
cn.ConnectionString = cs;
return cn;
}
public static List<String> getEQGroupLiist(string GroupColumn,string table)
{
List<string> retval = new List<string>();
var cn = getCn();
cn.Open();
var sql = "select {0} from {1} where isnull({0},'') != '' group by {0} order by {0}";
sql = string.Format(sql, "[" + GroupColumn +"]",table);
var cmd = new System.Data.SqlClient.SqlCommand(sql,cn);
var rdr = cmd.ExecuteReader();
while(rdr.Read())
{
retval.Add(rdr[0].ToString());
}
cmd.Dispose();
cn.Close();
cn.Dispose();
return retval;
}
}
}