Пример #1
0
        public string new256(string dataname, string sqlstring)
        {
            database       database    = new database();
            List <dbparam> dbparamlist = new List <dbparam>();

            switch (dataname)
            {
            case "mssql":
                return(database.selectMsSql(database.connectionString(sqlstring), "select NEWID();", dbparamlist).Rows[0][0].ToString().TrimEnd());

            case "postgresql":
                return(database.selectPostgreSql(database.connectionString(sqlstring), "select uuid_generate_v4();", dbparamlist).Rows[0][0].ToString().TrimEnd());

            default:
                return(null);
            }
        }
Пример #2
0
        public string sqldate(string dataname, string sqlstring)
        {
            database       database    = new database();
            List <dbparam> dbparamlist = new List <dbparam>(); // "select convert(varchar,getdate(),111);"

            switch (dataname)
            {
            case "mssql":
                return(database.selectMsSql(database.connectionString(sqlstring), "select convert(varchar,getdate(),111);", dbparamlist).Rows[0][0].ToString().TrimEnd());

            case "postgresql":
                return(database.selectPostgreSql(database.connectionString(sqlstring), "select to_char(now(),'YYYY/MM/DD');", dbparamlist).Rows[0][0].ToString().TrimEnd());

            default:
                return(null);
            }
        }