GetConnString() public method

Dynamically create a connection string.
public GetConnString ( ) : string
return string
示例#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();
                 }
             }
         }
     }
 }
示例#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();
                 }
             }
         }
     }
 }
示例#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();
                 }
             }
         }
     }
 }
示例#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();
                 }
             }
         }
     }
 }