private void CreateLogTable(AppSql.SQL SqlClient, string TableName, DataColumn[] DataColumns)
    {
        string vStrSQL = "" + "CREATE TABLE IF NOT EXISTS [" + TableName + "]" + " ([UID] CHAR(36) PRIMARY KEY ASC NOT NULL," + " [Time] DATETIME NOT NULL," + " [Category] VARCHAR(20)," + " [Class] VARCHAR(50)," + " [Function] VARCHAR(50)," + " [Description] VARCHAR(4000)," + " [Sent] INTEGER";

        foreach (DataColumn vStaticColumn in DataColumns)
        {
            vStrSQL += ", [" + vStaticColumn.ColumnName + "] ";
            switch (vStaticColumn.DataType.Name.ToUpper())
            {
            case "STRING":
                vStrSQL += "VARCHAR(" + vStaticColumn.MaxLength.ToString() + ")";
                break;

            case "BYTE":
            case "INTEGER":
            case "INT16":
            case "INT32":
            case "INT64":
                vStrSQL += "INTEGER";
                break;

            case "DATE":
            case "DATETIME":
                vStrSQL += "DATETIME";
                break;

            case "SINGLE,DOUBLE,DECIMAL":
                vStrSQL += "DECIMAL(18,2)";
                break;

            default:
                vStrSQL += "VARCHAR(4000)";
                break;
            }
        }
        vStrSQL += ");";
        _Sql.Exec(vStrSQL);
    }
    private System.Collections.Generic.List <System.Data.Common.DbParameter> GetInsertParameters(AppSql.SQL SqlClient, DataColumn[] DataColumns)
    {
        List <DbParameter> vParList = new List <DbParameter>();

        vParList.Add(SqlClient.NewParameter("UID", DbType.String));
        vParList.Add(SqlClient.NewParameter("Time", DbType.DateTime));
        vParList.Add(SqlClient.NewParameter("Category", DbType.String));
        vParList.Add(SqlClient.NewParameter("Class", DbType.String));
        vParList.Add(SqlClient.NewParameter("Function", DbType.String));
        vParList.Add(SqlClient.NewParameter("Description", DbType.String));
        vParList.Add(SqlClient.NewParameter("Sent", DbType.Int32));

        if (DataColumns != null)
        {
            foreach (DataColumn vStaticColumn in DataColumns)
            {
                switch (vStaticColumn.DataType.Name.ToUpper())
                {
                case "STRING":
                    vParList.Add(SqlClient.NewParameter(vStaticColumn.ColumnName, DbType.String));
                    break;

                case "BYTE":
                case "INTEGER":
                case "INT16":
                case "INT32":
                case "INT64":
                    vParList.Add(SqlClient.NewParameter(vStaticColumn.ColumnName, DbType.Int64));
                    break;

                case "DATE":
                case "DATETIME":
                    vParList.Add(SqlClient.NewParameter(vStaticColumn.ColumnName, DbType.DateTime));
                    break;

                case "SINGLE,DOUBLE,DECIMAL":
                    vParList.Add(SqlClient.NewParameter(vStaticColumn.ColumnName, DbType.Decimal));
                    break;

                default:
                    vParList.Add(SqlClient.NewParameter(vStaticColumn.ColumnName, DbType.String));
                    break;
                }
            }
        }
        return(vParList);
    }