GetConnString() public method

Dynamically create a connection string.
public GetConnString ( ) : string
return string
Ejemplo n.º 1
0
 /// <summary>
 /// This will execute the sql statements.
 /// </summary>
 /// <param name="tableStatements"></param>
 /// <param name="dbName"></param>
 private static void ExecuteStatements(string[] tableStatements, InstallerConfig config)
 {
     if (tableStatements.Length > 0)
     {
         using (SqlConnection conn = new SqlConnection())
         {
             IConnectionStringComponent component = new ConnectionStringComponent(config);
             conn.ConnectionString = component.GetConnString();
             conn.Open();
             using (SqlCommand command = new SqlCommand(string.Empty, conn))
             {
                 foreach (string statement in tableStatements)
                 {
                     command.CommandText = statement;
                     command.ExecuteNonQuery();
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// This will execute the sql statements.
 /// </summary>
 /// <param name="tableStatements"></param>
 /// <param name="dbName"></param>
 private void ExecuteStatements(string[] tableStatements, InstallerConfig config)
 {
     if (tableStatements.Length > 0)
     {
         using (SqlConnection conn = new SqlConnection())
         {
             IConnectionStringComponent component = new ConnectionStringComponent(config);
             conn.ConnectionString = component.GetConnString();
             conn.Open();
             using (SqlCommand command = new SqlCommand(string.Empty, conn))
             {
                 foreach (string statement in tableStatements)
                 {
                     command.CommandText = statement;
                     command.ExecuteNonQuery();
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// This will execute the sql statements.
 /// </summary>
 /// <param name="tableStatements"></param>
 /// <param name="dbName"></param>
 private static void ExecuteStatements(string[] tableStatements, InstallerConfig config)
 {
     if (tableStatements.Length > 0)
     {
         using (SqlConnection conn = new SqlConnection())
         {
             // Make sure we're not returning the EntityFramework connection string.
             config.Database.EntityFrameworkEntitiesName = "";
             IConnectionStringComponent component = new ConnectionStringComponent(config);
             conn.ConnectionString = component.GetConnString();
             conn.Open();
             using (SqlCommand command = new SqlCommand(string.Empty, conn))
             {
                 foreach (string statement in tableStatements)
                 {
                     command.CommandText = statement;
                     command.ExecuteNonQuery();
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// This will execute the sql statements.
 /// </summary>
 /// <param name="tableStatements"></param>
 /// <param name="dbName"></param>
 private static void ExecuteStatements(string[] tableStatements, InstallerConfig config)
 {
     if (tableStatements.Length > 0)
     {
         using (SqlConnection conn = new SqlConnection())
         {
             // Make sure we're not returning the EntityFramework connection string.
             config.Database.EntityFrameworkEntitiesName = "";
             IConnectionStringComponent component = new ConnectionStringComponent(config);
             conn.ConnectionString = component.GetConnString();
             conn.Open();
             using (SqlCommand command = new SqlCommand(string.Empty, conn))
             {
                 foreach (string statement in tableStatements)
                 {
                     command.CommandText = statement;
                     command.ExecuteNonQuery();
                 }
             }
         }
     }
 }