initial commit
This commit is contained in:
36
Project/Manager/DataBaseManager.cs
Normal file
36
Project/Manager/DataBaseManager.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Project.Manager
|
||||
{
|
||||
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)
|
||||
{
|
||||
List<string> retval = new List<string>();
|
||||
var cn = getCn();
|
||||
cn.Open();
|
||||
var sql = "select {0} from Equipment where isnull({0},'') != '' group by {0} order by {0}";
|
||||
sql = string.Format(sql, "[" + GroupColumn +"]");
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user