コード例 #1
0
		/// <summary>
		/// Runs sql script.
		/// </summary>
		/// <param name="connectionString">Sql server connection string.</param>
		/// <param name="database">Sql server database name.</param>
		/// <param name="fileName">Sql script file</param>
		private void RunSqlScript(string connectionString, string database, string fileName)
		{
			if (!File.Exists(fileName))
			{
				Log.WriteInfo(string.Format("File {0} not found", fileName));
				return;
			}

			Log.WriteStart("Installing database objects");

			//showing process
			SqlProcess process = new SqlProcess(this.progressBar, fileName, connectionString, database);
			process.Run();

			Log.WriteEnd("Installed database objects");
		}
コード例 #2
0
		/// <summary>
		/// Runs sql script.
		/// </summary>
		/// <param name="connectionString">Sql server connection string.</param>
		/// <param name="database">Sql server database name.</param>
		/// <param name="fileName">Sql script file</param>
		private void RunSqlScript(string connectionString, string database, string fileName)
		{
			if (!File.Exists(fileName))
			{
				Log.WriteInfo(string.Format("File {0} not found", fileName));
				return;
			}

			Log.WriteStart("Installing database objects");

			//showing process
			SqlProcess process = new SqlProcess(fileName, connectionString, database);
			// Update progress change
			process.ProgressChange += new EventHandler<ActionProgressEventArgs<int>>((object sender, ActionProgressEventArgs<int> e) =>
			{
				this.progressBar.Value = e.EventData;
			});
			//
			process.Run();

			Log.WriteEnd("Installed database objects");
		}