protected override object GetDataFromDB() { DataSet ds = new DataSet(); DataSet sysDs = new SysData(); try { SqlCommand cmd = new SqlCommand(selectSql); ds = DBUtility.FillData(cmd, DBUtility.BestToneCenterConStr); DataColumnCollection columns = ds.Tables[0].Columns; foreach (DataRow row in ds.Tables[0].Rows) { DataRow newRow = sysDs.Tables[SysData.TableName].NewRow(); foreach(DataColumn column in columns) { if (!sysDs.Tables[SysData.TableName].Columns.Contains(column.ColumnName)) continue; newRow[column.ColumnName] = row[column.ColumnName]; } sysDs.Tables[SysData.TableName].Rows.Add(newRow); } } catch (Exception ex) { throw ex; } return sysDs; }
/// <summary> /// 从数据库获取SP数据集合 /// </summary> /// <returns></returns> private object GetSysData() { SysData sysData = new SysData(); DataSet tmpData = new DataSet(); try { SqlCommand selCmd = new SqlCommand(); selCmd.CommandType = CommandType.Text; selCmd.CommandText = SysInfoManager.SqlGetSys; // 获取数据 tmpData = DBUtility.FillData(selCmd, DBUtility.BestToneCenterConStr); // 数据转换 // DataSet --> SysData int intTargetColumnCount = sysData.Tables[SysData.TableName].Columns.Count; foreach (DataRow row in tmpData.Tables[0].Rows) { object[] newRow = new object[intTargetColumnCount]; for (int j = 0; j < intTargetColumnCount; j++) { newRow[j] = row[j]; } sysData.Tables[SysData.TableName].Rows.Add(newRow); } } catch (Exception Ex) { throw Ex; } return(sysData); }
protected override object GetDataFromDB() { DataSet ds = new DataSet(); DataSet sysDs = new SysData(); try { SqlCommand cmd = new SqlCommand(selectSql); ds = DBUtility.FillData(cmd, DBUtility.BestToneCenterConStr); DataColumnCollection columns = ds.Tables[0].Columns; foreach (DataRow row in ds.Tables[0].Rows) { DataRow newRow = sysDs.Tables[SysData.TableName].NewRow(); foreach (DataColumn column in columns) { if (!sysDs.Tables[SysData.TableName].Columns.Contains(column.ColumnName)) { continue; } newRow[column.ColumnName] = row[column.ColumnName]; } sysDs.Tables[SysData.TableName].Rows.Add(newRow); } } catch (Exception ex) { throw ex; } return(sysDs); }
/// <summary> /// 根据SysID获取指定属性 /// </summary> /// <param name="PhoneAreaCode"></param> /// <param name="PropertyName"></param> /// <param name="PhoneAreaDataObj"></param> /// <returns></returns> public string GetPropertyBySysID(string SysID, string PropertyName, object SysDataObj) { string propertyValue = ""; SysData SysData = (SysData)SysDataObj; if (SysData == null) { return(propertyValue); } if (SysData.Tables[SysData.TableName].Rows.Count == 0) { return(propertyValue); } foreach (DataRow row in SysData.Tables[SysData.TableName].Rows) { if (SysID == Convert.ToString(row[SysData.Field_SysID])) { propertyValue = Convert.ToString(row[PropertyName]); break; } } return(propertyValue); }
/// <summary> /// �����ݿ��ȡSP���ݼ��� /// </summary> /// <returns></returns> private object GetSysData() { SysData sysData = new SysData(); DataSet tmpData = new DataSet(); try { SqlCommand selCmd = new SqlCommand(); selCmd.CommandType = CommandType.Text; selCmd.CommandText = SysInfoManager.SqlGetSys; // ��ȡ���� tmpData = DBUtility.FillData(selCmd, DBUtility.BestToneCenterConStr); // ����ת�� // DataSet --> SysData int intTargetColumnCount = sysData.Tables[SysData.TableName].Columns.Count; foreach (DataRow row in tmpData.Tables[0].Rows) { object[] newRow = new object[intTargetColumnCount]; for (int j = 0; j < intTargetColumnCount; j++) { newRow[j] = row[j]; } sysData.Tables[SysData.TableName].Rows.Add(newRow); } } catch (Exception Ex) { throw Ex; } return sysData; }