Exemple #1
0
		public static bool Parse(string str, out SqlServerVersion version)
		{
			version = new SqlServerVersion();

			if (String.IsNullOrEmpty(str))
				return false;

			var sversion = str.Split('.');

			if (sversion.Length != 3)
				return false;

			version.ver1 = "'" + Convert.ToInt32(sversion[0], CultureInfo.InvariantCulture) + "'";
			version.ver2 = Convert.ToInt32(sversion[1], CultureInfo.InvariantCulture);
			version.ver3 = Convert.ToInt32(sversion[2], CultureInfo.InvariantCulture);

			return true;
		}
Exemple #2
0
        public DataTable GetSchema(SqlConnection con, string collectionName, object[] restrictions)
        {
            if (con != _hcon)
            {
                _hcon = con;
                if (!SqlServerVersion.Parse(_hcon.ServerVersion, out _version))
                {
                    throw new ArgumentException("Invalid server version", "con");
                }
            }

            var dataTable = new DataTable(collectionName);

            using (var command = BuildCommand(con, collectionName, restrictions))
                using (var adapter = new SqlDataAdapter(command))
                    adapter.Fill(dataTable);

            return(ProcessResult(dataTable));
        }
Exemple #3
0
        public static bool Parse(string str, out SqlServerVersion version)
        {
            version = new SqlServerVersion();

            if (String.IsNullOrEmpty(str))
            {
                return(false);
            }

            var sversion = str.Split('.');

            if (sversion.Length != 3)
            {
                return(false);
            }

            version.ver1 = "'" + Convert.ToInt32(sversion[0], CultureInfo.InvariantCulture) + "'";
            version.ver2 = Convert.ToInt32(sversion[1], CultureInfo.InvariantCulture);
            version.ver3 = Convert.ToInt32(sversion[2], CultureInfo.InvariantCulture);

            return(true);
        }