public string GetAdministratorPassword()
        {
            string Rv = "";
            Connection_SqlServer Cn = new Connection_SqlServer();
            try
            {
                Cn.Connect();

                List<QueryParameter> Sp = new List<QueryParameter>();
                Sp.Add(new QueryParameter("ParameterName", "Administrator_Password"));
                Sp.Add(new QueryParameter("ParameterValue", "Password"));
                Cn.ExecuteNonQuery("usp_Require_System_Parameter", Sp);
                DataTable Dt = Cn.ExecuteQuery(@"Select dbo.udf_Get_System_Parameter('Administrator_Password')").Tables[0];

                if (Dt.Rows.Count > 0)
                { Rv = (string)Do_Methods.IsNull(Dt.Rows[0][0], ""); }
            }
            catch { }
            finally { Cn.Close(); }

            return Rv;
        }
コード例 #2
0
 /// <summary>
 /// Connects to the datasource defined in Do_Globals.gSettings.Datasource
 /// </summary>
 public void Connect()
 {
     this.mConnection = new Connection_SqlServer();
     this.mConnection.Connect();
 }
コード例 #3
0
 /// <summary>
 /// Returns a Empy List based on the supplied source data object Name
 /// Used for getting the definition of the data object
 /// </summary>
 /// <param name="ObjectName">
 /// The source data object name
 /// </param>
 /// <returns></returns>
 public DataTable List_Empty(string ObjectName)
 {
     if (this.mConnection == null)
     {
         Connection_SqlServer Cn = new Connection_SqlServer();
         try
         {
             Cn.Connect();
             return this.List_Empty(Cn, ObjectName);
         }
         catch (Exception Ex)
         { throw Ex; }
         finally
         { Cn.Close(); }
     }
     else
     { return this.List_Empty(this.mConnection, ObjectName); }
 }
コード例 #4
0
 /// <summary>
 /// Returns the Result Set Count with out actually fetching the result set, mainly used for pagination
 /// </summary>
 /// <param name="ObjectName">
 /// The source data object name
 /// </param>
 /// <param name="Condition">
 /// ClsQueryCondition Object to be used in fetching the data
 /// </param>
 /// <returns></returns>
 public long List_Count(string ObjectName, QueryCondition Condition = null)
 {
     if (this.mConnection == null)
     {
         Connection_SqlServer Cn = new Connection_SqlServer();
         try
         {
             Cn.Connect();
             return this.List_Count(Cn, ObjectName, Condition);
         }
         catch (Exception Ex)
         { throw Ex; }
         finally
         { Cn.Close(); }
     }
     else
     { return this.List_Count(this.mConnection, ObjectName, Condition); }
 }
コード例 #5
0
 /// <summary>
 /// Returns a List based on the supplied Table/View Name
 /// </summary>
 /// <param name="ObjectName">
 /// The source data object name
 /// </param>
 /// <param name="Condition">
 /// ClsQueryCondition Object to be used in fetching the data
 /// </param>
 /// <param name="Sort">
 /// Additional sorting to be used in fetching the data
 /// </param>
 /// <param name="Top">
 /// Limits the result set, mainly used for pagination
 /// </param>
 /// <param name="Page">
 /// Fetch a section of the result set based on the supplied Top, mainly used for pagination
 /// </param>
 /// <returns></returns>
 public DataTable List(
     string ObjectName
     , QueryCondition Condition
     , string Sort = ""
     , Int64 Top = 0
     , Int32 Page = 0)
 {
     if (this.mConnection == null)
     {
         Connection_SqlServer Cn = new Connection_SqlServer();
         try
         {
             Cn.Connect();
             return this.List(Cn, ObjectName, Condition, Sort, Top, Page);
         }
         catch (Exception Ex)
         { throw Ex; }
         finally
         { Cn.Close(); }
     }
     else
     { return this.List(this.mConnection, ObjectName, Condition, Sort, Top, Page); }
 }
コード例 #6
0
 /// <summary>
 /// Returns a List based on the supplied Table/View Name
 /// </summary>
 /// <param name="ObjectName">
 /// The source data object name
 /// </param>
 /// <param name="Condition">
 /// Additional conditions to be used in fetching the data
 /// </param>
 /// <param name="Sort">
 /// Additional sorting to be used in fetching the data
 /// </param>
 /// <returns></returns>
 public DataTable List(
     string ObjectName
     , string Condition = ""
     , string Sort = "")
 {
     if (this.mConnection == null)
     {
         Connection_SqlServer Cn = new Connection_SqlServer();
         try
         {
             Cn.Connect();
             return this.List(Cn, ObjectName, Condition, Sort);
         }
         catch (Exception Ex)
         { throw Ex; }
         finally
         { Cn.Close(); }
     }
     else
     { return this.List(this.mConnection, ObjectName, Condition, Sort); }
 }
コード例 #7
0
        void ExportReport()
        {
            Connection_SqlServer Cn = new Connection_SqlServer();
            try
            {
                Cn.Connect();
                List<QueryParameter> List_Sp = new List<QueryParameter>();
                List_Sp.Add(new QueryParameter("ExamID", Do_Methods.Convert_Int64(this.mObj_Exam.pDr_Exam["RecruitmentTestExamsID"])));

                DataTable Dt = Cn.ExecuteQuery("usp_LoadExam_Detailed", List_Sp).Tables[0];

                Layer01_Common.Objects.ClsExcel_Columns Col = new Layer01_Common.Objects.ClsExcel_Columns();
                Col.Add("Desc");
                Col.Add("Correct_Desc");

                System.IO.StringWriter Sw = Methods_Excel.CreateExcel_HTML(Dt, Col);
                this.Response.Clear();
                this.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "Report.xls"));
                this.Response.ContentType = "application/ms-excel";
                this.Response.ContentEncoding = System.Text.Encoding.Default;
                this.Response.Charset = string.Empty;
                this.Response.Write(Sw.ToString());
                this.Response.End();
            }
            catch { }
            finally
            { Cn.Close(); }
        }
コード例 #8
0
 public static DateTime GetServerDate()
 {
     Connection_SqlServer Da = new Connection_SqlServer();
     try
     {
         Da.Connect();
         return GetServerDate(Da);
     }
     catch (Exception ex)
     { throw ex; }
     finally
     { Da.Close(); }
 }
コード例 #9
0
 public DataTable GetQuery(Do_Constants.Str_QuerySource SourceObject, String Fields, QueryCondition Condition, String Sort = "", Int64 Top = 0, Int32 Page = 0)
 {
     if (this.mConnection == null)
     {
         Connection_SqlServer Cn = new Connection_SqlServer();
         try
         {
             Cn.Connect();
             return this.GetQuery(Cn, SourceObject, Fields, Condition, Sort, Top, Page);
         }
         catch (Exception ex)
         { throw ex; }
         finally
         { Cn.Close(); }
     }
     else
     { return this.GetQuery(this.mConnection, SourceObject, Fields, Condition, Sort, Top, Page); }
 }
コード例 #10
0
 public DataSet ExecuteQuery(DbCommand Cmd)
 {
     if (this.mConnection == null)
     {
         Connection_SqlServer Cn = new Connection_SqlServer();
         try
         {
             Cn.Connect();
             return ExecuteQuery(Cn, Cmd);
         }
         catch (Exception Ex)
         { throw Ex; }
         finally
         { Cn.Close(); }
     }
     else
     { return this.ExecuteQuery(this.mConnection, Cmd); }
 }
コード例 #11
0
 public DataSet ExecuteQuery(string ProcedureName, List<QueryParameter> ProcedureParameters)
 {
     if (this.mConnection == null)
     {
         Connection_SqlServer Cn = new Connection_SqlServer();
         try
         {
             Cn.Connect();
             return ExecuteQuery(Cn, ProcedureName, ProcedureParameters);
         }
         catch (Exception Ex) { throw Ex; }
         finally { Cn.Close(); }
     }
     else
     { return ExecuteQuery(this.mConnection, ProcedureName, ProcedureParameters); }
 }
コード例 #12
0
 public int ExecuteNonQuery(string Query)
 {
     Connection_SqlServer Cn = new Connection_SqlServer();
     try
     {
         Cn.Connect();
         return ExecuteNonQuery(Cn, Query);
     }
     catch (Exception Ex) { throw Ex; }
     finally { Cn.Close(); }
 }
コード例 #13
0
        public PreparedQuery CreatePreparedQuery(string Query = "", List<QueryParameter> Parameters = null)
        {
            Connection_SqlServer Cn = this.mConnection;
            if (Cn == null)
            {
                Cn = new Connection_SqlServer();
                Cn.Connect();
            }

            return new PreparedQuery_SqlServer(Cn, Query, Parameters);
        }
コード例 #14
0
 /// <summary>
 /// Sets a new value to the specified system parameter
 /// </summary>
 /// <param name="ParameterName">
 /// The system parameter name
 /// </param>
 /// <param name="ParameterValue">
 /// The value to be set
 /// </param>
 public void SetSystemParameter(string ParameterName, string ParameterValue)
 {
     Connection_SqlServer Cn = new Connection_SqlServer();
     try
     {
         Cn.Connect();
         this.SetSystemParameter(ParameterName, ParameterValue);
     }
     catch (Exception ex)
     { throw ex; }
     finally
     { Cn.Close(); }
 }
コード例 #15
0
 /// <summary>
 /// Connects to the specified datasource
 /// </summary>
 /// <param name="ConnectionString">
 /// The specified connection definition to the datasource
 /// </param>
 public void Connect(string ConnectionString)
 {
     this.mConnection = new Connection_SqlServer();
     this.mConnection.Connect(ConnectionString);
 }
コード例 #16
0
 public static DateTime GetServerDate(Connection_SqlServer Da)
 {
     DataTable Dt = Da.ExecuteQuery("Select GetDate() As ServerDate").Tables[0];
     if (Dt.Rows.Count > 0) return (DateTime)Dt.Rows[0][0];
     else return DateTime.Now;
 }
コード例 #17
0
 /// <summary>
 /// Gets the specified system parameter value, or creates a new system parameter with the specified default value
 /// </summary>
 /// <param name="ParameterName">
 /// The system parameter name
 /// </param>
 /// <param name="DefaultValue">
 /// The default value for the parameter if it doesn't exists
 /// </param>
 /// <returns></returns>
 public string GetSystemParameter(string ParameterName, string DefaultValue = "")
 {
     Connection_SqlServer Cn = new Connection_SqlServer();
     try
     {
         Cn.Connect();
         return this.GetSystemParameter(Cn, ParameterName, DefaultValue);
     }
     catch (Exception ex)
     { throw ex; }
     finally
     { Cn.Close(); }
 }
コード例 #18
0
 /// <summary>
 /// Gets the definition of the requested data object
 /// </summary>
 /// <param name="TableName">
 /// The requested data object name
 /// </param>
 /// <returns></returns>
 public DataTable GetTableDef(string TableName)
 {
     DataTable Rv = null;
     List<QueryParameter> Sp = new List<QueryParameter>();
     Sp.Add(new QueryParameter("@TableName", TableName));
     Connection_SqlServer Cn = new Connection_SqlServer();
     try
     {
         Cn.Connect();
         Rv = Cn.ExecuteQuery("usp_DataObjects_GetTableDef", Sp).Tables[0];
     }
     catch { }
     finally
     { Cn.Close(); }
     return Rv;
 }
コード例 #19
0
        /// <summary>
        /// Saves the datarow to the target table in the current connection.
        /// </summary>
        /// <param name="ObjDataRow">
        /// The source datarow to be saved.
        /// </param>
        /// <param name="TableName">
        /// The name of the table to be operated.
        /// </param>
        /// <param name="SchemaName">
        /// The name of the schema of the target table.
        /// </param>
        /// <param name="IsDelete">
        /// If true, the operation will be a Delete operation.
        /// </param>
        /// <param name="CustomKeys">
        /// Custom Key definition.
        /// </param>
        /// <returns></returns>
        public bool SaveDataRow(
            DataRow ObjDataRow
            , string TableName
            , string SchemaName = ""
            , bool IsDelete = false
            , List<string> CustomKeys = null)
        {
            bool Cns_IsSoftDelete = Do_Globals.gSettings.pUseSoftDelete;

            //[-]

            if (SchemaName == "")
            { SchemaName = "dbo"; }

            eProcess cProcess = eProcess.Process_Insert;
            DataTable Dt_TableDef = new DataTable(TableName);
            DataTable Dt_Def;
            List<QueryParameter> List_Param;

            //[Get Table Definition]
            List_Param = new List<QueryParameter>();
            List_Param.Add(new QueryParameter(@"@TableName", TableName));
            List_Param.Add(new QueryParameter(@"@SchemaName", SchemaName));

            Dt_Def = this.ExecuteQuery("usp_DataObjects_GetTableDef", List_Param).Tables[0];
            foreach (DataRow Inner_Dr in Dt_Def.Rows)
            {
                System.Type Inner_Type = null;
                bool Inner_IsFound = true;
                switch (Do_Methods.IsNull(Inner_Dr["DataType"], "").ToString().ToLower())
                {
                    case "tinyint":
                        Inner_Type = typeof(System.Byte);
                        break;
                    case "smallint":
                        Inner_Type = typeof(System.Int16);
                        break;
                    case "int":
                        Inner_Type = typeof(System.Int32);
                        break;
                    case "bigint":
                        Inner_Type = typeof(System.Int64);
                        break;
                    case "bit":
                        Inner_Type = typeof(System.Boolean);
                        break;
                    case "decimal":
                    case "numeric":
                        Inner_Type = typeof(System.Double);
                        break;
                    case "datetime":
                    case "smalldatetime":
                        Inner_Type = typeof(System.DateTime);
                        break;
                    case "char":
                    case "varchar":
                    case "text":
                    case "nchar":
                    case "nvarchar":
                    case "ntext":
                        Inner_Type = typeof(System.String);
                        break;
                    default:
                        Inner_IsFound = false;
                        break;
                }

                if (Inner_IsFound) { Dt_TableDef.Columns.Add((string)Do_Methods.IsNull(Inner_Dr["ColumnName"], ""), Inner_Type); }
            }

            if (CustomKeys != null)
            {
                foreach (DataRow Inner_Dr in Dt_Def.Rows)
                { Inner_Dr["IsPk"] = false; }

                foreach (string Inner_Key in CustomKeys)
                {
                    DataRow[] Inner_ArrDr = Dt_Def.Select("ColumnName = '" + Inner_Key + "'");
                    if (Inner_ArrDr.Length > 0)
                    { Inner_ArrDr[0]["IsPk"] = true; }
                }
            }

            //Check ObjDataRow Fields for PK Data

            bool IsFound = false;
            Int32 PKsCt = 0;
            Int32 PKsFoundCt = 0;

            DataRow[] ArrDr_Dt_Def;
            ArrDr_Dt_Def = Dt_Def.Select("IsPK = 1");
            PKsCt = ArrDr_Dt_Def.Length;

            foreach (DataRow Inner_Dr in ArrDr_Dt_Def)
            {
                foreach (DataColumn Inner_Dc in ObjDataRow.Table.Columns)
                {
                    if ((string)Inner_Dr["ColumnName"] == Inner_Dc.ColumnName)
                    {
                        if (Do_Methods.Convert_Int64(ObjDataRow[Inner_Dc.ColumnName]) != 0)
                        {
                            PKsFoundCt++;
                            if (PKsFoundCt >= PKsCt) break;
                        }
                    }
                }
            }

            //Check Process
            if (PKsFoundCt != PKsCt)
            {
                cProcess = eProcess.Process_Insert;

                DataRow[] ArrDr_Dt_Def_Pks = Dt_Def.Select(@"IsPK = 1 And IsIdentity = 0");
                foreach (DataRow Inner_Dr in ArrDr_Dt_Def_Pks)
                {
                    //Check PK if there is already a value
                    //If there is, continue the loop
                    string Inner_ColumnName = (string)Do_Methods.IsNull(Inner_Dr["ColumnName"], "");
                    if (Do_Methods.Convert_Int64(ObjDataRow[Inner_ColumnName]) != 0)
                    { continue; }

                    Connection_SqlServer Da = new Connection_SqlServer();
                    try
                    {
                        Da.Connect();
                        Da.BeginTransaction();

                        Int64 NewID;
                        List_Param = new List<QueryParameter>();
                        List_Param.Add(new QueryParameter(@"@TableName", TableName + "." + Inner_ColumnName));
                        NewID = Do_Methods.Convert_Int64(Da.ExecuteQuery("usp_DataObjects_GetNextID", List_Param).Tables[0].Rows[0][0]);
                        ObjDataRow[Inner_ColumnName] = NewID;

                        Da.CommitTransaction();
                    }
                    catch (Exception ex)
                    {
                        Da.RollbackTransaction();
                        throw ex;
                    }
                    finally
                    {
                        Da.Close();
                        Da = null;
                    }
                }
            }
            else
            {
                //Check if Row to be updated has rows to be updated
                //If none the return the function true
                DataRow[] Inner_ArrDr = Dt_Def.Select(@"IsPk = 0 And IsIdentity = 0");
                if (Inner_ArrDr.Length == 0)
                { return true; }

                cProcess = eProcess.Process_Update;
            }

            if (IsDelete)
            {
                if (cProcess == eProcess.Process_Update)
                {
                    if (!Cns_IsSoftDelete)
                    { cProcess = eProcess.Process_Delete; }
                    else
                    { ObjDataRow["IsDeleted"] = true; }
                }
                else
                { return true; }
            }

            //Prepare SQL Statement
            PreparedQuery Pq = new DataAccess_SqlServer().CreatePreparedQuery();

            string Query_InsertFields = "";
            string Query_InsertFieldsValues = "";
            string Query_UpdateFields = "";
            string Query_Comma = "";

            foreach (DataColumn Dc_ObjDataRow in ObjDataRow.Table.Columns)
            {
                IsFound = false;
                foreach (DataColumn Dc_TableDef in Dt_TableDef.Columns)
                {
                    if (Dc_ObjDataRow.ColumnName.ToLower() == Dc_TableDef.ColumnName.ToLower())
                    {
                        switch (cProcess)
                        {
                            case eProcess.Process_Insert:
                                IsFound = true;
                                break;
                            case eProcess.Process_Update:
                                DataRow[] Inner_ArrDr = Dt_Def.Select(@"ColumnName = '" + Dc_ObjDataRow.ColumnName + "' And IsPk = 1");
                                if (Inner_ArrDr.Length == 0) IsFound = true;
                                break;
                        }
                        if (IsFound) break;
                    }
                }

                if (IsFound)
                {
                    DataRow[] Inner_ArrDr_Def = Dt_Def.Select(@"ColumnName = '" + Dc_ObjDataRow.ColumnName + "'" + " And IsIdentity = 0");
                    if (Inner_ArrDr_Def.Length == 0) continue;

                    switch (cProcess)
                    {
                        case eProcess.Process_Insert:
                            Query_InsertFields += " " + Query_Comma + @" [" + Dc_ObjDataRow.ColumnName + @"] ";
                            Query_InsertFieldsValues += " " + Query_Comma + @" @" + Dc_ObjDataRow.ColumnName.Replace(@" ", @"_") + " ";
                            break;
                        case eProcess.Process_Update:
                            Query_UpdateFields += " " + Query_Comma + @" [" + Dc_ObjDataRow.ColumnName + @"] = @" + Dc_ObjDataRow.ColumnName.Replace(@" ", @"_") + " ";
                            break;
                    }

                    Query_Comma = ",";

                    //SqlParameter Inner_Sp = new SqlParameter(@"@" + Dc_ObjDataRow.ColumnName.Replace(" ", "_"), this.SqlDataTypeLib((string)Inner_ArrDr_Def[0]["DataType"]), Convert.ToInt32(Inner_ArrDr_Def[0]["Length"]));
                    //Inner_Sp.Direction = ParameterDirection.Input;
                    //Inner_Sp.Precision = (byte)Inner_ArrDr_Def[0]["Precision"];
                    //Inner_Sp.Scale = (byte)Inner_ArrDr_Def[0]["Scale"];
                    //Pq.pParameters.Add(Inner_Sp);

                    Pq.Add_Parameter(new QueryParameter()
                    {
                        Name = Dc_ObjDataRow.ColumnName.Replace(" ", "_"),
                        Type = this.ParameterTypeLib(Do_Methods.Convert_String(Inner_ArrDr_Def[0]["DataType"])),
                        Size = Do_Methods.Convert_Int32(Inner_ArrDr_Def[0]["Length"]),
                        Precision = Do_Methods.Convert_Byte(Inner_ArrDr_Def[0]["Precision"]),
                        Scale = Do_Methods.Convert_Byte(Inner_ArrDr_Def[0]["Scale"])
                    });
                }
            }

            DataRow[] Inner_ArrDr_Pk;

            switch (cProcess)
            {
                case eProcess.Process_Insert:
                    StringBuilder Sb_Query_Output = new StringBuilder();
                    StringBuilder Sb_Query_Output_Table = new StringBuilder();
                    string Query_Output = "";
                    char Query_Output_Comma = ' ';
                    string Query_Output_Table = "";
                    string Query_Output_Table_Select = "";

                    Inner_ArrDr_Pk = Dt_Def.Select("IsPK = 1 And IsIdentity = 1");
                    foreach (DataRow Inner_Dr in Inner_ArrDr_Pk)
                    {
                        Sb_Query_Output.Append(@" " + Query_Output_Comma + @" Inserted.[" + (string)Do_Methods.IsNull(Inner_Dr["ColumnName"], "") + @"] Into @Tb");
                        Sb_Query_Output_Table.Append(@" " + Query_Output_Comma + @" [" + (string)Do_Methods.IsNull(Inner_Dr["ColumnName"], "") + @"] " + (string)Do_Methods.IsNull(Inner_Dr["DataType"], ""));
                        Query_Output_Comma = ',';
                    }

                    Query_Output = Sb_Query_Output.ToString();
                    if (Query_Output.Trim() != "") Query_Output = " Output " + Query_Output;

                    Query_Output_Table = Sb_Query_Output_Table.ToString();
                    if (Query_Output_Table.Trim() != "")
                    {
                        Query_Output_Table = @" Declare @Tb As Table (" + Query_Output_Table + @"); ";
                        Query_Output_Table_Select = " Select * From @Tb ";
                    }

                    if (Query_InsertFields != "")
                    {
                        Query_InsertFields = "(" + Query_InsertFields + ")";
                        Query_InsertFieldsValues = " Values (" + Query_InsertFieldsValues + ") ";
                    }
                    else
                    {
                        //This path will be reached if the table to be inserted has only one field that is an identity field
                        Query_InsertFieldsValues = " Default Values ";
                    }

                    Pq.pQuery = Query_Output_Table + " Insert Into [" + SchemaName + "].[" + TableName + "] " + Query_InsertFields + " " + Query_Output + " " + Query_InsertFieldsValues + "; " + Query_Output_Table_Select;
                    break;
                case eProcess.Process_Update:
                    string Query_UpdateCriteria = "";
                    Query_Comma = "";

                    Inner_ArrDr_Pk = Dt_Def.Select("IsPk = 1");
                    foreach (DataRow Inner_Dr in Inner_ArrDr_Pk)
                    {
                        DataRow[] Inner_ArrDr_TableDef = Dt_Def.Select(@"ColumnName = '" + (string)Inner_Dr["ColumnName"] + @"'");
                        Query_UpdateCriteria += " " + Query_Comma + " [" + Inner_Dr["ColumnName"] + "] = @" + ((string)Inner_Dr["ColumnName"]).Replace(" ", "_") + " ";
                        Query_Comma = "And";

                        //SqlParameter Inner_Sp = new SqlParameter("@" + ((string)Inner_Dr["ColumnName"]).Replace(" ", "_"), this.SqlDataTypeLib((string)Inner_Dr["DataType"]), Convert.ToInt32(Inner_Dr["Length"]));
                        //Inner_Sp.Direction = ParameterDirection.Input;
                        //Inner_Sp.Precision = (byte)Inner_Dr["Precision"];
                        //Inner_Sp.Scale = (byte)Inner_Dr["Scale"];
                        //Pq.pParameters.Add(Inner_Sp);

                        Pq.Add_Parameter(new QueryParameter()
                        {
                            Name = Do_Methods.Convert_String(Inner_Dr["ColumnName"]).Replace(" ", "_"),
                            Type = this.ParameterTypeLib(Do_Methods.Convert_String(Inner_Dr["DataType"])),
                            Size = Do_Methods.Convert_Int32(Inner_Dr["Length"]),
                            Precision = Do_Methods.Convert_Byte(Inner_Dr["Precision"]),
                            Scale = Do_Methods.Convert_Byte(Inner_Dr["Scale"])
                        });
                    }

                    Pq.pQuery = "Update [" + SchemaName + "].[" + TableName + "] Set " + Query_UpdateFields + " Where " + Query_UpdateCriteria;
                    break;
                case eProcess.Process_Delete:
                    string Query_DeleteCriteria = "";
                    Query_Comma = "";

                    Inner_ArrDr_Pk = Dt_Def.Select("IsPk = 1");
                    foreach (DataRow Inner_Dr in Inner_ArrDr_Pk)
                    {
                        DataRow[] Inner_ArrDr_TableDef = Dt_Def.Select(@"ColumnName = '" + (string)Inner_Dr["ColumnName"] + @"'");
                        Query_DeleteCriteria += " " + Query_Comma + " [" + Inner_Dr["ColumnName"] + "] = @" + ((string)Inner_Dr["ColumnName"]).Replace(" ", "_") + " ";
                        Query_Comma = "And";

                        //SqlParameter Inner_Sp = new SqlParameter("@" + ((string)Inner_Dr["ColumnName"]).Replace(" ", "_"), this.SqlDataTypeLib((string)Inner_Dr["DataType"]), Convert.ToInt32(Inner_Dr["Length"]));
                        //Inner_Sp.Direction = ParameterDirection.Input;
                        //Inner_Sp.Precision = (byte)Inner_Dr["Precision"];
                        //Inner_Sp.Scale = (byte)Inner_Dr["Scale"];
                        //Pq.pParameters.Add(Inner_Sp);

                        Pq.Add_Parameter(new QueryParameter()
                        {
                            Name = Do_Methods.Convert_String(Inner_Dr["ColumnName"]).Replace(" ", "_"),
                            Type = this.ParameterTypeLib(Do_Methods.Convert_String(Inner_Dr["DataType"])),
                            Size = Do_Methods.Convert_Int32(Inner_Dr["Length"]),
                            Precision = Do_Methods.Convert_Byte(Inner_Dr["Precision"]),
                            Scale = Do_Methods.Convert_Byte(Inner_Dr["Scale"])
                        });
                    }

                    Pq.pQuery = "Delete [" + SchemaName + "].[" + TableName + "] Where " + Query_DeleteCriteria;
                    break;
            }

            Pq.Prepare();

            foreach (DataColumn Dc_ObjDataRow in ObjDataRow.Table.Columns)
            {
                //foreach (SqlParameter Inner_Sp in Pq.pParameters)
                //{
                //    if ("@" + Dc_ObjDataRow.ColumnName.Replace(" ", "_") == Inner_Sp.ParameterName)
                //    {
                //        if (Information.IsDBNull(Dc_ObjDataRow)) Inner_Sp.Value = DBNull.Value;
                //        else Inner_Sp.Value = this.SqlConvertDataType(ObjDataRow[Dc_ObjDataRow], Inner_Sp.SqlDbType.ToString());
                //        continue;
                //    }
                //}

                foreach (QueryParameter Inner_Sp in Pq.pParameters)
                {
                    if (Dc_ObjDataRow.ColumnName.Replace(" ", "_") == Inner_Sp.Name)
                    {
                        if (Information.IsDBNull(Dc_ObjDataRow))
                        { Inner_Sp.Value = DBNull.Value; }
                        else
                        { Inner_Sp.Value = ObjDataRow[Dc_ObjDataRow]; }
                        continue;
                    }
                }
            }

            DataSet Ds_Output;
            DataTable Dt_Output;

            Ds_Output = Pq.ExecuteQuery();
            if (Ds_Output.Tables.Count > 0)
            {
                Dt_Output = Ds_Output.Tables[0];
                foreach (DataColumn Inner_Dc in Dt_Output.Columns)
                {
                    ObjDataRow[Inner_Dc.ColumnName] = Dt_Output.Rows[0][Inner_Dc.ColumnName];
                }
            }
            return true;
        }