Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Install SMO or Alternative?
Message
De
15/03/2011 12:23:39
 
 
À
15/03/2011 12:15:01
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01503651
Message ID:
01503738
Vues:
30
Hello Bonnie.

Thank for your tips!

This might be the optimum

  • First advice the user whats out there.
  • Then have the user decide what to do: Instal new here or use existing
  • Then based on the decicion install smo or have the user even go to the existing sql server (physicly) and continue the install there, then i don't need to install smo (i think it installs with sql, correct?)

    Do you think that approach would be acceptable in a shrink-wrapped environment?

    thanks again for your help.


    >Hi Gunnar,
    >
    >There are several things you can do using classes in the System.Data.Sql and System.Data.SqlClient namespaces.
    >
    >1) To get a list of all SqlServers on your network, use this:
    >
    >DataTable dt = System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources();
    >
    >The returned DataTable contains a column, ServerName.
    >
    >2) You can use SqlConnection to get a list of the databases on a given server:
    >
    >SqlConnectionStringBuilder csBuilder;
    >security = "Integrated Security=True"; 
    >csBuilder = new SqlConnectionStringBuilder(string.Format("server={0};{1}", ServerName, security))
    >using (SqlConnection connection = new SqlConnection(this.csBuilder.ConnectionString))
    >{
    >    connection.Open();
    >    this.dtDatabases = connection.GetSchema("Databases");
    >    connection.Close();
    >
    >    // to get a list of tables in a database
    >    foreach (DataRow row in this.dtDatabases.Rows)
    >    {
    >	// for some reason, accessing the "model" database in this manner prevents the 
    >	// CREATE DATABASE from getting an exclusive lock on it, even though the connection gets closed
    >	// so we'll exclude it from this process
    >	if (row["database_name"].ToString().ToLower() == "model")
    >		continue;
    >
    >	this.csBuilder.InitialCatalog = row["database_name"].ToString();
    >	connection.ConnectionString = this.csBuilder.ConnectionString;
    >	connection.Open();
    >	this.dtTableNames = connection.GetSchema("Tables", new string[] { null, null, null, "BASE TABLE" });
    >        // more code
    >    }
    >
    >
    >Now, that said, I've also utilized SMO for updating tables in databases and the like, but by using the above code for at least finding servers on the network, you may be able to tell whether you need to install SMO or not.
    >
    >~~Bonnie
    >
    >
    >
    >>Hello Everybody.
    >>
    >>I am currently writing my own setup/install routine. Mostly because it’s a very complex installation and I don't know how and if this can be done with the free install shield version.
    >>
    >>In this vb.net application, one part handles the SQL setup. For this, the program needs to:
    >>
  • collect all installed SQL instances on the network
    >>
  • test connection string
    >>
  • create a new database, table, views, UDF, and Database User
    >>
  • list existing Databases and their tables
    >>Currently I accomplish this via the SMO namespace. It works great!
    >>
    >>However, it only works great on my development machine because SMO is installed here through an SQL installation.
    >>
    >>The installation must be able to do all this without having to install an SQL (or express) instance.
    >>
    >>So, here are my questions:
    >>
  • how to install "only" SMO manually?
    >>
  • is there an alternative and/or a better way to accomplish the above tasks?
    >>
    >>As always I truly appreciate your help!
  • Précédent
    Suivant
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform