public List<SysObject> GetAllKeys() { string sqlStr = "select top 100 [id], [xtype], [name] from sysobjects where xtype = 'F' or xtype = 'PK'"; DataTable dt = ExecuteQuery(sqlStr); List<SysObject> sysObjectList = new List<SysObject>(); foreach (DataRow dataRow in dt.Rows) { SysObject pb = new SysObject(); pb.Id = dataRow["id"].ToString(); pb.Xtype = dataRow["xtype"].ToString(); pb.Name = dataRow["name"].ToString(); sysObjectList.Add(pb); } return sysObjectList; }
public List<SysObject> GetAllTables() { string sqlStr = "select top 100 [name] from sysobjects where xtype = 'U'"; DataTable dt = ExecuteQuery(sqlStr); List<SysObject> sysTableList = new List<SysObject>(); foreach (DataRow dataRow in dt.Rows) { SysObject pb = new SysObject(); pb.Name = dataRow["name"].ToString(); sysTableList.Add(pb); } return sysTableList; }
public List<SysObject> GetEmployeeAndMetaData() { string sqlStr = "select s.name, s.id, s.xtype from dbo.sysobjects s where name like 'CRONUS Sverige AB$Employee%' and xtype = 'U'"; DataTable dt = ExecuteQuery(sqlStr); List<SysObject> employeeAbsenceList = new List<SysObject>(); foreach (DataRow dataRow in dt.Rows) { SysObject pb = new SysObject(); pb.Name = dataRow["name"].ToString(); pb.Id = dataRow["id"].ToString(); pb.Xtype = dataRow["xtype"].ToString(); employeeAbsenceList.Add(pb); } return employeeAbsenceList; }