예제 #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);
            }
        }
예제 #3
0
        public string sqlclient(string dataname, string clientip)
        {
            database       database    = new database();
            List <dbparam> dbparamlist = new List <dbparam>();

            switch (dataname)
            {
            case "mssql":
                return(Dns.GetHostEntry(clientip).HostName.IndexOf('.') == -1 ? Dns.GetHostEntry(clientip).HostName : Dns.GetHostEntry(clientip).HostName.Split('.')[0]);

            //return database.selectMsSql( database.connectionString( sqlstring ), "select host_name();", dbparamlist ).Rows[0][0].ToString().TrimEnd();
            case "postgresql":
                return(null);

            default:
                return(null);
            }
        }