Scalar() публичный Метод

Returns a single result
public Scalar ( DynamicCommand command ) : object
command DynamicCommand
Результат object
Пример #1
0
        private static DatabaseDialect ProbeSqlServer(DynamicDatabase database)
        {
            string versionString;
            try
            {
                versionString = (string)database.Scalar(@"SELECT SERVERPROPERTY('productversion');");
            }
            catch (SqlException)
            {
                versionString = "0";
            }

            int version;
            if (Int32.TryParse(versionString.Split('.').First(), out version) && version > 0)
            {
                return new SqlServerDialect(version);
            }

            return null;
        }
Пример #2
0
        private static DatabaseDialect ProbeSqlServer(DynamicDatabase database)
        {
            string versionString;

            try
            {
                versionString = (string)database.Scalar(@"SELECT SERVERPROPERTY('productversion');");
            }
            catch (SqlException)
            {
                versionString = "0";
            }

            int version;

            if (Int32.TryParse(versionString.Split('.').First(), out version) && version > 0)
            {
                return(new SqlServerDialect(version));
            }

            return(null);
        }