Пример #1
0
        public override async Task <string> HostNameAsync()
        {
            var lRs = new XMLRS();
            await lRs.OpenAsync("Select HostName=host_name()", this);

            if (lRs.EOF)
            {
                throw new Exception("Server not available");
            }
            string lRes = lRs[0].ToString();

            lRs.Close();
            return(lRes);
        }
Пример #2
0
        public override async Task <DateTime> ServerDateAsync()
        {
            var lRs = new XMLRS();
            await lRs.OpenAsync("Select Date=convert(varchar,Getdate(),120)", this);

            if (!lRs.HasRows)
            {
                throw new Exception("Server not available");
            }
            string[] lDateTot = lRs[0].ToString().Split(' ');
            lRs.Close();
            string[] lDate = lDateTot[0].Split('-');
            string[] lTime = lDateTot[1].Split(':');
            DateTime lRes  = new DateTime(Convert.ToInt32(lDate[0]), Convert.ToInt32(lDate[1]), Convert.ToInt32(lDate[2]), Convert.ToInt32(lTime[0]), Convert.ToInt32(lTime[1]), Convert.ToInt32(lTime[2]));

            return(lRes);
        }