public Dictionary.DropView DROP_Dictionary_View(IConnectToDB _Connect, string ViewName) { List <DBParameters> EntryProcedureParameters = new List <DBParameters>(); ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run { sqlIn = "Select * from CSA.ER_VIEWS where UPPER(VIEW_NAME) = @VIEW_NAME", _dbParameters = new List <DBParameters> { new DBParameters { ParamName = "VIEW_NAME", MSSqlParamDataType = SqlDbType.VarChar, ParamValue = ViewName.ToUpper() } } }; DataTable _DT = ER_Query._RUN_PARAMETER_QUERY(_Connect, SQlin); DataColumnCollection DCC = _DT.Columns; Dictionary.DropView thisModel = new Dictionary.DropView(); if (_DT.Rows.Count > 0 && DCC.Contains("ER_VIEWS_ID")) { thisModel = new Dictionary.DropView { I_ER_VIEWS_ID = _DT.Rows[0].Field <long?>("ER_VIEWS_ID") }; Universal_Call <Dictionary.DropView> dv = new Universal_Call <Dictionary.DropView>(); thisModel = dv.GenericInputProcedure(_Connect, thisModel); } return(thisModel); }
public DataTable GET_COLUMNS_VIA_TABLENAME(IConnectToDB _Connect, string TableName) { StringBuilder SQLin = new StringBuilder(); SQLin.Append("Select COLUMN_NAME, DATA_TYPE, "); switch (_Connect.Platform) { case "Microsoft": case "MICROSOFT": SQLin.Append("CHARACTER_OCTET_LENGTH DATA_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE "); SQLin.Append("from INFORMATION_SCHEMA.COLUMNS "); SQLin.Append("where upper(TABLE_NAME) = upper(@TABLE_NAME) "); SQLin.Append("order by ORDINAL_POSITION ASC "); ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run { sqlIn = SQLin.ToString(), _dbParameters = new List <DBParameters> { new DBParameters { ParamName = "TABLE_NAME", MSSqlParamDataType = SqlDbType.VarChar, ParamValue = TableName } } }; return(ER_Query._RUN_PARAMETER_QUERY(_Connect, SQlin)); default: return(new DataTable()); } }
public static bool checkIfTableExist(IConnectToDB _Connect, string schema, string tablename) { string _sqlIn = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = @TABLE_SCHEMA AND TABLE_NAME = @TABLE_NAME"; ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run { sqlIn = _sqlIn, _dbParameters = new List <DBParameters> { new DBParameters { ParamName = "TABLE_SCHEMA", MSSqlParamDataType = SqlDbType.BigInt, ParamValue = schema }, new DBParameters { ParamName = "TABLE_NAME", MSSqlParamDataType = SqlDbType.BigInt, ParamValue = tablename } } }; DataTable _DT = ER_Query._RUN_PARAMETER_QUERY(_Connect, SQlin); DataColumnCollection DCC = _DT.Columns; return(_DT.Rows.Count > 0 && DCC.Contains("TABLE_SCHEMA") ? true : false); }