Click here to Skip to main content
15,892,674 members
Articles / Database Development / SQL Server

DACBuilder – Data Access objects generation tool based on XML and XSL templates transformation

Rate me:
Please Sign up or sign in to vote.
5.00/5 (13 votes)
31 Mar 2006CPOL23 min read 76.4K   1.9K   68  
The DACBuilder application provides auto-generation features from multiple database systems in multiple programming languages.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;
using System.IO;
using System.Text;
using System.Configuration;
using System.Text.RegularExpressions;
using DotNetScripting;
using Framework.DACCreator;
using Microsoft.Win32;

namespace DACBuilder
{
	
	public struct SearchTextParams
	{
		public string FindWhat;
		public int SearchStart;
		public int SearchEnd;
		public RichTextBoxFinds FindOptions;
	}
	/// <summary>
	/// Summary description for BForm.
	/// </summary>
	public class BForm : System.Windows.Forms.Form
	{
		private string ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];//DataAccessComponent.ConnectionString;
		private string templatesPath;
		private System.Windows.Forms.ComboBox cboLanguages;
		private Timer timColorCoding;

		string[] args = null;
		private DataTable dtTables;
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Panel panel2;
		private System.Windows.Forms.Splitter splitter1;
		private System.Windows.Forms.Panel panel3;
		private System.Windows.Forms.Label lblTable;
		private System.Windows.Forms.Label lblLanguage;
		private System.Windows.Forms.ComboBox cboTables;
		private System.Windows.Forms.RichTextBox txtCode;
		private System.Windows.Forms.StatusBar statusBar1;
		private System.Windows.Forms.MainMenu mainMenu;
		private System.Windows.Forms.MenuItem mnuStructure;
		private System.Windows.Forms.MenuItem mnuDAC;
		private System.Windows.Forms.MenuItem mnuDACCompile;
		private System.Windows.Forms.MenuItem mnuDACCreateAssembly;
		private System.Windows.Forms.MenuItem mnuSp;
		private System.Windows.Forms.MenuItem mnuSpGenerate;
		private System.Windows.Forms.MenuItem mnuSpParse;
		private System.Windows.Forms.MenuItem mnuSpExecute;
		private System.Windows.Forms.MenuItem mnuDACBar1;
		private System.Windows.Forms.MenuItem mnuSpBar1;
		private System.Windows.Forms.StatusBarPanel sbPanelAssembly;
		private System.Windows.Forms.StatusBarPanel sbPanelCurrentFile;
		private DataSet dsTable;
		private string CurrentFile = "";
		private string CurrentAssembly = "";
		private bool bIsDirty = false;
		private System.Windows.Forms.ComboBox cboOptAssemblies;
		private System.Windows.Forms.Button btnOpAssembliesAdd;
		private System.Windows.Forms.Button btnOptAssembliesDelete;
		private System.Windows.Forms.MenuItem mnuStructureRefresh;
		private ArrayList optionalAssemblies = null;
		private System.Windows.Forms.ListView lvOperationsState;
		private System.Windows.Forms.ColumnHeader columnHeader1;
		private System.Windows.Forms.ColumnHeader columnHeader2;
		private System.Windows.Forms.ColumnHeader columnHeader3;
		private System.Windows.Forms.ColumnHeader columnHeader4;
		private System.Windows.Forms.DataGrid dgColumns;
		private System.Windows.Forms.Splitter splitter2;
		private ToolTip toolTip1;
		private RichTextBox auxRTF;
		private Regex reCoding;
		private System.Windows.Forms.MenuItem mnuSpOracleProcedures;
		private System.Windows.Forms.MenuItem mnuDACGenerateResources;
		private System.Windows.Forms.MenuItem mnuUI;
		private System.Windows.Forms.MenuItem mnuUIGenerateWebForm;
		private System.Windows.Forms.MenuItem mnuUISep1;
		private System.Windows.Forms.ContextMenu txtCodeMenu;
		private System.Windows.Forms.MenuItem mnuItem_txtCodeMenu_Cut;
		private System.Windows.Forms.MenuItem mnuItem_txtCodeMenu_Copy;
		private System.Windows.Forms.MenuItem mnuItem_txtCodeMenu_Paste;
		private System.Windows.Forms.MenuItem mnuItem_txtCodeMenu_Bar1;
		private System.Windows.Forms.MenuItem mnuItem_txtCodeMenu_SelectAll;
		private Color color;
		private System.Windows.Forms.MenuItem mnuSpOtherSqlTemplates;
		private System.Windows.Forms.MenuItem mnuDACSimpleDAC;
		private System.Windows.Forms.MenuItem mnuSpSelectByPK;
		private System.Windows.Forms.MenuItem mnuToolsClearErrors;
		private System.Windows.Forms.MenuItem mnuTools;
		private System.Windows.Forms.MenuItem mnuToolsApplyColorCoding;
		private System.Windows.Forms.MenuItem mnuToolsFont;
		private XmlDocument xslParametersDoc;
		private string regKeyName = "SOFTWARE\\DACBuilder";
		private string keyFontFamily = "keyFontFamily";
		private string keyFontSize = "keyFontSize";
		private System.Windows.Forms.MenuItem mnuStructureTables;
		private System.Windows.Forms.MenuItem mnuStructureViews;
		private string keyFontStyle = "keyFontStyle";
		private System.Windows.Forms.Button btnOpStandardAssemblies;
		private System.Windows.Forms.ContextMenu standardAssembliesMenu;
		private System.Windows.Forms.MenuItem mnuSpBar2;
		private System.Windows.Forms.MenuItem mnuToolsSep1;
		private System.Windows.Forms.MenuItem mnuToolsNewConnection;
		private System.Windows.Forms.MenuItem mnuUIGenerateWebUserControl;
		private System.Windows.Forms.MenuItem mnuUIGenerateHTML;
		private System.Windows.Forms.MenuItem mnuUISimpleDAC;
		private System.Windows.Forms.MenuItem mnuEdit;
		private System.Windows.Forms.MenuItem mnuEditFind;

		private ObjectTypes ObjectType = ObjectTypes.None;
		private System.Windows.Forms.MenuItem mnuEditFindNext;
		private System.Windows.Forms.MenuItem mnuEditUndo;
		private System.Windows.Forms.MenuItem mnuEditBar1;
		private System.Windows.Forms.MenuItem mnuEditCopy;
		private System.Windows.Forms.MenuItem mnuEditBar2;
		private System.Windows.Forms.MenuItem mnuEditCut;
		private System.Windows.Forms.MenuItem mnuEditPaste;
		private System.Windows.Forms.MenuItem mnuEditRedo;
		private System.Windows.Forms.MenuItem mnuEditBar3;
		private System.Windows.Forms.MenuItem mnuEditSelectAll;

		private SearchTextParams searchParams;
		private System.Windows.Forms.MenuItem mnuMiscDAC;
		private System.Windows.Forms.MenuItem mnuMiscDACPHPDAC;
		private System.Windows.Forms.MenuItem mnuMiscDACPHPDataAccess;
		private bool bAtStart = false;
		private System.Windows.Forms.MenuItem mnuSpSQLCreateTable;
		private System.Windows.Forms.MenuItem mnuSpSQLGenerateInsertRows;
		private System.Windows.Forms.MenuItem mnuDACSimpleDACOleDb;
		private System.Windows.Forms.MenuItem mnuDACSimpleDACOdbc;
		private System.Windows.Forms.MenuItem mnuDACGenerateSchema;
		private System.Windows.Forms.MenuItem mnuUIGenerateWindowsForm_resx;
		private System.Windows.Forms.MenuItem mnuUISimpleDACMethods_win;
		private System.Windows.Forms.MenuItem mnuSpSearch;
		private System.Windows.Forms.MenuItem mnuStructureBar11;
		private System.Windows.Forms.MenuItem mnuStructureBar2;
		private System.Windows.Forms.MenuItem mnuStructureRefreshRoutinesList;
		private System.Windows.Forms.MenuItem mnuStructrueBar3;
		private System.Windows.Forms.MenuItem mnuStructureStoredPrcedures;
		private System.Windows.Forms.MenuItem mnuStructureFunctions;
		private System.Windows.Forms.MenuItem mnuStructureGetTable;
		private System.Windows.Forms.MenuItem mnuStructureGetRoutine;
		private System.Windows.Forms.MenuItem mnuDACExecRoutine;
		private System.Windows.Forms.MenuItem mnuMiscDACVB60DAC;
		private System.Windows.Forms.MenuItem mnuMiscDACVBScriptDAC;
		private System.Windows.Forms.MenuItem mnuToolsConnectionStrings;
		private System.Windows.Forms.MenuItem mnuCustomFields;
		private System.Windows.Forms.MenuItem mnuCustomFieldsDBEntities;
		private System.Windows.Forms.MenuItem mnuCustomFieldsTable_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsTable_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsManagement;
		private System.Windows.Forms.MenuItem mnuCustomFieldsTableColumn_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsTableColumn_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsType_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsType_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsSecurity_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsSecurity_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsPropertyList_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsPropertyList_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsProperty_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsProperty_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValueList_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValueList_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesBool_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesBool_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesDateTime_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesDateTime_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesDecimal_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesDecimal_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesInteger_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesInteger_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesString_tbl;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesString_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsGenerateView;
		private System.Windows.Forms.MenuItem mnuCustomFieldsBar1;
		private System.Windows.Forms.MenuItem mnuCustomFieldsGetPropertyListValues_fn;
		private System.Windows.Forms.MenuItem mnuCustomFieldsGetTableCustomFieldsXML_sp;
		private System.Windows.Forms.MenuItem mnuSpfnGetExtendedProperty_fn;
		private System.Windows.Forms.MenuItem mnuSpGetTableColumnsXML_sp;
		private System.Windows.Forms.MenuItem mnuSpGetRoutineParametersXML_sp;
		private System.Windows.Forms.MenuItem mnuDACBar3;
		private System.Windows.Forms.MenuItem mnuDACDataAccessContainer_SQL;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem mnuDACDataAccessComponent_SQL;
		private System.Windows.Forms.MenuItem mnuDACDataAccessContainer_Odbc;
		private System.Windows.Forms.MenuItem mnuDACDataAccessContainer_OleDb;
		private System.Windows.Forms.MenuItem mnuDACDataAccessComponent_OleDb;
		private System.Windows.Forms.MenuItem mnuDataAccessComponent_Odbc;
		private System.Windows.Forms.MenuItem mnuSpKeyTables_tbl;
		private System.Windows.Forms.MenuItem mnuSpGET_NEXT_ID_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsDACentities;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesBool_DAC;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesDateTime_DAC;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesDecimal_DAC;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesInteger_DAC;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValuesString_DAC;
		private System.Windows.Forms.MenuItem mnuCustomFieldsGenerateClass;
		private System.Windows.Forms.MenuItem mnuCustomFieldsValues_DELETE_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsGenerateRead_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsDBEntitiesBar2;
		private System.Windows.Forms.MenuItem mnuCustomFieldsDBEntitiesAll;
		private System.Windows.Forms.MenuItem mnuCustomFieldsCustomFieldsTableColumn_SELECT_ByFKTable_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsGetPrimaryKeyColumnName_sp;
		private System.Windows.Forms.MenuItem mnuCustomFieldsDBEntitiesCustomFieldsTable_SELECT_ByName_sp;
		private System.Windows.Forms.MenuItem mnuToolsClearText;
		private System.Windows.Forms.MenuItem mnuMiscDACJScriptDAC;
		private System.Windows.Forms.MenuItem mnuCustomFieldsDACEntitiesBar1;
		private System.Windows.Forms.MenuItem mnuCustomFieldsDACEntitiesUtil;
		private System.Windows.Forms.MenuItem mnuToolsDACExample;
		private System.Windows.Forms.MenuItem mnuCustomFieldsCustomFieldsType_insert;
		private System.Windows.Forms.MenuItem mnuFile;
		private System.Windows.Forms.MenuItem mnuFileOpen;
		private System.Windows.Forms.MenuItem mnuFileSave;
		private System.Windows.Forms.MenuItem mnuFileSaveAs;
		private System.Windows.Forms.MenuItem mnuFileBar1;
		private System.Windows.Forms.MenuItem mnuFileExit;
		private System.Windows.Forms.MenuItem mnuToolsGetXML;
		private DBTypes dbType;
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{	
			Application.Run(new BForm(args));
		}

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public BForm(string[] args)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			this.args = args;
			dsTable = new DataSet();
			optionalAssemblies = new ArrayList();
			auxRTF = new RichTextBox();
			timColorCoding = new Timer();
			timColorCoding.Interval = 1000;
			timColorCoding.Tick += new EventHandler(timColorCoding_Tick);
			timColorCoding.Enabled = false;
			templatesPath = Application.StartupPath + @"\Templates\";
			BuildRegExpr(LanguageType.CSharp.ToString());

			string sFontFamily = ReadKey(keyFontFamily, "Arial").ToString();
			float fFontSize = float.Parse(ReadKey(keyFontSize, 10).ToString());
			FontStyle fontStyle = (FontStyle)((int)ReadKey(keyFontStyle, FontStyle.Regular));
			txtCode.Font = new Font(sFontFamily, fFontSize, fontStyle);

			try
			{
				dbType = (DBTypes)Enum.Parse(typeof(DBTypes), ConfigurationSettings.AppSettings["DBType"]);
			}
			catch
			{
				dbType = DBTypes.SQL;
			}

		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}


		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(BForm));
			this.cboLanguages = new System.Windows.Forms.ComboBox();
			this.panel1 = new System.Windows.Forms.Panel();
			this.panel3 = new System.Windows.Forms.Panel();
			this.txtCode = new System.Windows.Forms.RichTextBox();
			this.txtCodeMenu = new System.Windows.Forms.ContextMenu();
			this.mnuItem_txtCodeMenu_Cut = new System.Windows.Forms.MenuItem();
			this.mnuItem_txtCodeMenu_Copy = new System.Windows.Forms.MenuItem();
			this.mnuItem_txtCodeMenu_Paste = new System.Windows.Forms.MenuItem();
			this.mnuItem_txtCodeMenu_Bar1 = new System.Windows.Forms.MenuItem();
			this.mnuItem_txtCodeMenu_SelectAll = new System.Windows.Forms.MenuItem();
			this.splitter1 = new System.Windows.Forms.Splitter();
			this.panel2 = new System.Windows.Forms.Panel();
			this.splitter2 = new System.Windows.Forms.Splitter();
			this.dgColumns = new System.Windows.Forms.DataGrid();
			this.lvOperationsState = new System.Windows.Forms.ListView();
			this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
			this.lblTable = new System.Windows.Forms.Label();
			this.lblLanguage = new System.Windows.Forms.Label();
			this.cboTables = new System.Windows.Forms.ComboBox();
			this.mainMenu = new System.Windows.Forms.MainMenu();
			this.mnuFile = new System.Windows.Forms.MenuItem();
			this.mnuFileOpen = new System.Windows.Forms.MenuItem();
			this.mnuFileSave = new System.Windows.Forms.MenuItem();
			this.mnuFileSaveAs = new System.Windows.Forms.MenuItem();
			this.mnuFileBar1 = new System.Windows.Forms.MenuItem();
			this.mnuFileExit = new System.Windows.Forms.MenuItem();
			this.mnuEdit = new System.Windows.Forms.MenuItem();
			this.mnuEditUndo = new System.Windows.Forms.MenuItem();
			this.mnuEditRedo = new System.Windows.Forms.MenuItem();
			this.mnuEditBar1 = new System.Windows.Forms.MenuItem();
			this.mnuEditCopy = new System.Windows.Forms.MenuItem();
			this.mnuEditCut = new System.Windows.Forms.MenuItem();
			this.mnuEditPaste = new System.Windows.Forms.MenuItem();
			this.mnuEditBar2 = new System.Windows.Forms.MenuItem();
			this.mnuEditFind = new System.Windows.Forms.MenuItem();
			this.mnuEditFindNext = new System.Windows.Forms.MenuItem();
			this.mnuEditBar3 = new System.Windows.Forms.MenuItem();
			this.mnuEditSelectAll = new System.Windows.Forms.MenuItem();
			this.mnuStructure = new System.Windows.Forms.MenuItem();
			this.mnuStructureGetTable = new System.Windows.Forms.MenuItem();
			this.mnuStructureRefresh = new System.Windows.Forms.MenuItem();
			this.mnuStructureBar11 = new System.Windows.Forms.MenuItem();
			this.mnuStructureTables = new System.Windows.Forms.MenuItem();
			this.mnuStructureViews = new System.Windows.Forms.MenuItem();
			this.mnuStructureBar2 = new System.Windows.Forms.MenuItem();
			this.mnuStructureGetRoutine = new System.Windows.Forms.MenuItem();
			this.mnuStructureRefreshRoutinesList = new System.Windows.Forms.MenuItem();
			this.mnuStructrueBar3 = new System.Windows.Forms.MenuItem();
			this.mnuStructureStoredPrcedures = new System.Windows.Forms.MenuItem();
			this.mnuStructureFunctions = new System.Windows.Forms.MenuItem();
			this.mnuDAC = new System.Windows.Forms.MenuItem();
			this.mnuDACSimpleDAC = new System.Windows.Forms.MenuItem();
			this.mnuDACSimpleDACOleDb = new System.Windows.Forms.MenuItem();
			this.mnuDACSimpleDACOdbc = new System.Windows.Forms.MenuItem();
			this.mnuDACExecRoutine = new System.Windows.Forms.MenuItem();
			this.mnuDACBar3 = new System.Windows.Forms.MenuItem();
			this.mnuDACDataAccessContainer_SQL = new System.Windows.Forms.MenuItem();
			this.mnuDACDataAccessContainer_OleDb = new System.Windows.Forms.MenuItem();
			this.mnuDACDataAccessContainer_Odbc = new System.Windows.Forms.MenuItem();
			this.mnuDACDataAccessComponent_SQL = new System.Windows.Forms.MenuItem();
			this.mnuDACDataAccessComponent_OleDb = new System.Windows.Forms.MenuItem();
			this.mnuDataAccessComponent_Odbc = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.mnuDACCompile = new System.Windows.Forms.MenuItem();
			this.mnuDACCreateAssembly = new System.Windows.Forms.MenuItem();
			this.mnuDACBar1 = new System.Windows.Forms.MenuItem();
			this.mnuDACGenerateResources = new System.Windows.Forms.MenuItem();
			this.mnuDACGenerateSchema = new System.Windows.Forms.MenuItem();
			this.mnuMiscDAC = new System.Windows.Forms.MenuItem();
			this.mnuMiscDACPHPDAC = new System.Windows.Forms.MenuItem();
			this.mnuMiscDACPHPDataAccess = new System.Windows.Forms.MenuItem();
			this.mnuMiscDACVB60DAC = new System.Windows.Forms.MenuItem();
			this.mnuMiscDACVBScriptDAC = new System.Windows.Forms.MenuItem();
			this.mnuMiscDACJScriptDAC = new System.Windows.Forms.MenuItem();
			this.mnuSp = new System.Windows.Forms.MenuItem();
			this.mnuSpGenerate = new System.Windows.Forms.MenuItem();
			this.mnuSpSelectByPK = new System.Windows.Forms.MenuItem();
			this.mnuSpSearch = new System.Windows.Forms.MenuItem();
			this.mnuSpSQLCreateTable = new System.Windows.Forms.MenuItem();
			this.mnuSpSQLGenerateInsertRows = new System.Windows.Forms.MenuItem();
			this.mnuSpOtherSqlTemplates = new System.Windows.Forms.MenuItem();
			this.mnuSpParse = new System.Windows.Forms.MenuItem();
			this.mnuSpExecute = new System.Windows.Forms.MenuItem();
			this.mnuSpBar1 = new System.Windows.Forms.MenuItem();
			this.mnuSpOracleProcedures = new System.Windows.Forms.MenuItem();
			this.mnuSpBar2 = new System.Windows.Forms.MenuItem();
			this.mnuSpfnGetExtendedProperty_fn = new System.Windows.Forms.MenuItem();
			this.mnuSpGetTableColumnsXML_sp = new System.Windows.Forms.MenuItem();
			this.mnuSpGetRoutineParametersXML_sp = new System.Windows.Forms.MenuItem();
			this.mnuSpKeyTables_tbl = new System.Windows.Forms.MenuItem();
			this.mnuSpGET_NEXT_ID_sp = new System.Windows.Forms.MenuItem();
			this.mnuUI = new System.Windows.Forms.MenuItem();
			this.mnuUIGenerateWebForm = new System.Windows.Forms.MenuItem();
			this.mnuUIGenerateWebUserControl = new System.Windows.Forms.MenuItem();
			this.mnuUIGenerateHTML = new System.Windows.Forms.MenuItem();
			this.mnuUIGenerateWindowsForm_resx = new System.Windows.Forms.MenuItem();
			this.mnuUISep1 = new System.Windows.Forms.MenuItem();
			this.mnuUISimpleDAC = new System.Windows.Forms.MenuItem();
			this.mnuUISimpleDACMethods_win = new System.Windows.Forms.MenuItem();
			this.mnuCustomFields = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsDBEntities = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsTable_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsTable_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsTableColumn_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsTableColumn_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsType_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsType_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsSecurity_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsSecurity_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsPropertyList_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsPropertyList_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsProperty_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsProperty_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValueList_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValueList_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesBool_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesBool_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesDateTime_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesDateTime_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesDecimal_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesDecimal_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesInteger_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesInteger_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesString_tbl = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesString_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsBar1 = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsGetPropertyListValues_fn = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsGetTableCustomFieldsXML_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValues_DELETE_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsCustomFieldsTableColumn_SELECT_ByFKTable_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsDBEntitiesCustomFieldsTable_SELECT_ByName_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsGetPrimaryKeyColumnName_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsDBEntitiesBar2 = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsDBEntitiesAll = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsCustomFieldsType_insert = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsDACentities = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesBool_DAC = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesDateTime_DAC = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesDecimal_DAC = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesInteger_DAC = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsValuesString_DAC = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsDACEntitiesBar1 = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsDACEntitiesUtil = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsManagement = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsGenerateView = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsGenerateRead_sp = new System.Windows.Forms.MenuItem();
			this.mnuCustomFieldsGenerateClass = new System.Windows.Forms.MenuItem();
			this.mnuTools = new System.Windows.Forms.MenuItem();
			this.mnuToolsClearErrors = new System.Windows.Forms.MenuItem();
			this.mnuToolsApplyColorCoding = new System.Windows.Forms.MenuItem();
			this.mnuToolsFont = new System.Windows.Forms.MenuItem();
			this.mnuToolsClearText = new System.Windows.Forms.MenuItem();
			this.mnuToolsDACExample = new System.Windows.Forms.MenuItem();
			this.mnuToolsSep1 = new System.Windows.Forms.MenuItem();
			this.mnuToolsNewConnection = new System.Windows.Forms.MenuItem();
			this.mnuToolsConnectionStrings = new System.Windows.Forms.MenuItem();
			this.statusBar1 = new System.Windows.Forms.StatusBar();
			this.sbPanelCurrentFile = new System.Windows.Forms.StatusBarPanel();
			this.sbPanelAssembly = new System.Windows.Forms.StatusBarPanel();
			this.cboOptAssemblies = new System.Windows.Forms.ComboBox();
			this.btnOpAssembliesAdd = new System.Windows.Forms.Button();
			this.btnOptAssembliesDelete = new System.Windows.Forms.Button();
			this.btnOpStandardAssemblies = new System.Windows.Forms.Button();
			this.standardAssembliesMenu = new System.Windows.Forms.ContextMenu();
			this.mnuToolsGetXML = new System.Windows.Forms.MenuItem();
			this.panel1.SuspendLayout();
			this.panel3.SuspendLayout();
			this.panel2.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dgColumns)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.sbPanelCurrentFile)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.sbPanelAssembly)).BeginInit();
			this.SuspendLayout();
			// 
			// cboLanguages
			// 
			this.cboLanguages.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboLanguages.Location = new System.Drawing.Point(344, 4);
			this.cboLanguages.Name = "cboLanguages";
			this.cboLanguages.Size = new System.Drawing.Size(121, 21);
			this.cboLanguages.TabIndex = 3;
			this.cboLanguages.SelectedIndexChanged += new System.EventHandler(this.cboLanguages_SelectedIndexChanged);
			// 
			// panel1
			// 
			this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.panel1.Controls.Add(this.panel3);
			this.panel1.Controls.Add(this.splitter1);
			this.panel1.Controls.Add(this.panel2);
			this.panel1.Location = new System.Drawing.Point(0, 32);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(904, 432);
			this.panel1.TabIndex = 6;
			// 
			// panel3
			// 
			this.panel3.Controls.Add(this.txtCode);
			this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panel3.Location = new System.Drawing.Point(475, 0);
			this.panel3.Name = "panel3";
			this.panel3.Size = new System.Drawing.Size(429, 432);
			this.panel3.TabIndex = 9;
			// 
			// txtCode
			// 
			this.txtCode.AcceptsTab = true;
			this.txtCode.AllowDrop = true;
			this.txtCode.AutoWordSelection = true;
			this.txtCode.ContextMenu = this.txtCodeMenu;
			this.txtCode.Dock = System.Windows.Forms.DockStyle.Fill;
			this.txtCode.Font = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtCode.HideSelection = false;
			this.txtCode.Location = new System.Drawing.Point(0, 0);
			this.txtCode.Name = "txtCode";
			this.txtCode.ShowSelectionMargin = true;
			this.txtCode.Size = new System.Drawing.Size(429, 432);
			this.txtCode.TabIndex = 0;
			this.txtCode.Text = "";
			this.txtCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCode_KeyDown);
			this.txtCode.TextChanged += new System.EventHandler(this.txtCode_TextChanged);
			this.txtCode.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtCode_KeyUp);
			// 
			// txtCodeMenu
			// 
			this.txtCodeMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						this.mnuItem_txtCodeMenu_Cut,
																						this.mnuItem_txtCodeMenu_Copy,
																						this.mnuItem_txtCodeMenu_Paste,
																						this.mnuItem_txtCodeMenu_Bar1,
																						this.mnuItem_txtCodeMenu_SelectAll});
			this.txtCodeMenu.Popup += new System.EventHandler(this.txtCodeMenu_Popup);
			// 
			// mnuItem_txtCodeMenu_Cut
			// 
			this.mnuItem_txtCodeMenu_Cut.Index = 0;
			this.mnuItem_txtCodeMenu_Cut.Shortcut = System.Windows.Forms.Shortcut.CtrlX;
			this.mnuItem_txtCodeMenu_Cut.Text = "Cut";
			this.mnuItem_txtCodeMenu_Cut.Click += new System.EventHandler(this.mnuItem_txtCodeMenu_Cut_Click);
			// 
			// mnuItem_txtCodeMenu_Copy
			// 
			this.mnuItem_txtCodeMenu_Copy.Index = 1;
			this.mnuItem_txtCodeMenu_Copy.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
			this.mnuItem_txtCodeMenu_Copy.Text = "Copy";
			this.mnuItem_txtCodeMenu_Copy.Click += new System.EventHandler(this.mnuItem_txtCodeMenu_Copy_Click);
			// 
			// mnuItem_txtCodeMenu_Paste
			// 
			this.mnuItem_txtCodeMenu_Paste.Index = 2;
			this.mnuItem_txtCodeMenu_Paste.Shortcut = System.Windows.Forms.Shortcut.CtrlV;
			this.mnuItem_txtCodeMenu_Paste.Text = "Paste";
			this.mnuItem_txtCodeMenu_Paste.Click += new System.EventHandler(this.mnuItem_txtCodeMenu_Paste_Click);
			// 
			// mnuItem_txtCodeMenu_Bar1
			// 
			this.mnuItem_txtCodeMenu_Bar1.Index = 3;
			this.mnuItem_txtCodeMenu_Bar1.Text = "-";
			// 
			// mnuItem_txtCodeMenu_SelectAll
			// 
			this.mnuItem_txtCodeMenu_SelectAll.Index = 4;
			this.mnuItem_txtCodeMenu_SelectAll.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
			this.mnuItem_txtCodeMenu_SelectAll.Text = "Select all";
			this.mnuItem_txtCodeMenu_SelectAll.Click += new System.EventHandler(this.mnuItem_txtCodeMenu_SelectAll_Click);
			// 
			// splitter1
			// 
			this.splitter1.Location = new System.Drawing.Point(472, 0);
			this.splitter1.Name = "splitter1";
			this.splitter1.Size = new System.Drawing.Size(3, 432);
			this.splitter1.TabIndex = 8;
			this.splitter1.TabStop = false;
			// 
			// panel2
			// 
			this.panel2.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.panel2.Controls.Add(this.splitter2);
			this.panel2.Controls.Add(this.dgColumns);
			this.panel2.Controls.Add(this.lvOperationsState);
			this.panel2.Dock = System.Windows.Forms.DockStyle.Left;
			this.panel2.Location = new System.Drawing.Point(0, 0);
			this.panel2.Name = "panel2";
			this.panel2.Size = new System.Drawing.Size(472, 432);
			this.panel2.TabIndex = 7;
			// 
			// splitter2
			// 
			this.splitter2.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.splitter2.Location = new System.Drawing.Point(0, 332);
			this.splitter2.Name = "splitter2";
			this.splitter2.Size = new System.Drawing.Size(472, 3);
			this.splitter2.TabIndex = 12;
			this.splitter2.TabStop = false;
			// 
			// dgColumns
			// 
			this.dgColumns.DataMember = "";
			this.dgColumns.Dock = System.Windows.Forms.DockStyle.Fill;
			this.dgColumns.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dgColumns.Location = new System.Drawing.Point(0, 0);
			this.dgColumns.Name = "dgColumns";
			this.dgColumns.Size = new System.Drawing.Size(472, 335);
			this.dgColumns.TabIndex = 11;
			// 
			// lvOperationsState
			// 
			this.lvOperationsState.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																								this.columnHeader1,
																								this.columnHeader2,
																								this.columnHeader3,
																								this.columnHeader4});
			this.lvOperationsState.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.lvOperationsState.Location = new System.Drawing.Point(0, 335);
			this.lvOperationsState.MultiSelect = false;
			this.lvOperationsState.Name = "lvOperationsState";
			this.lvOperationsState.Size = new System.Drawing.Size(472, 97);
			this.lvOperationsState.Sorting = System.Windows.Forms.SortOrder.Ascending;
			this.lvOperationsState.TabIndex = 10;
			this.lvOperationsState.View = System.Windows.Forms.View.Details;
			this.lvOperationsState.DoubleClick += new System.EventHandler(this.lvOperationsState_DoubleClick);
			this.lvOperationsState.SelectedIndexChanged += new System.EventHandler(this.lvOperationsState_SelectedIndexChanged);
			// 
			// columnHeader1
			// 
			this.columnHeader1.Text = "Error";
			this.columnHeader1.Width = 250;
			// 
			// columnHeader2
			// 
			this.columnHeader2.Text = "Line";
			this.columnHeader2.Width = 40;
			// 
			// columnHeader3
			// 
			this.columnHeader3.Text = "Column";
			this.columnHeader3.Width = 50;
			// 
			// columnHeader4
			// 
			this.columnHeader4.Text = "File";
			this.columnHeader4.Width = 100;
			// 
			// lblTable
			// 
			this.lblTable.Location = new System.Drawing.Point(6, 8);
			this.lblTable.Name = "lblTable";
			this.lblTable.Size = new System.Drawing.Size(42, 16);
			this.lblTable.TabIndex = 7;
			this.lblTable.Text = "Table";
			// 
			// lblLanguage
			// 
			this.lblLanguage.Location = new System.Drawing.Point(256, 7);
			this.lblLanguage.Name = "lblLanguage";
			this.lblLanguage.Size = new System.Drawing.Size(88, 16);
			this.lblLanguage.TabIndex = 8;
			this.lblLanguage.Text = ".NET Language";
			this.lblLanguage.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// cboTables
			// 
			this.cboTables.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboTables.Location = new System.Drawing.Point(56, 4);
			this.cboTables.Name = "cboTables";
			this.cboTables.Size = new System.Drawing.Size(192, 21);
			this.cboTables.TabIndex = 13;
			// 
			// mainMenu
			// 
			this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.mnuFile,
																					 this.mnuEdit,
																					 this.mnuStructure,
																					 this.mnuDAC,
																					 this.mnuMiscDAC,
																					 this.mnuSp,
																					 this.mnuUI,
																					 this.mnuCustomFields,
																					 this.mnuTools});
			// 
			// mnuFile
			// 
			this.mnuFile.Index = 0;
			this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					this.mnuFileOpen,
																					this.mnuFileSave,
																					this.mnuFileSaveAs,
																					this.mnuFileBar1,
																					this.mnuFileExit});
			this.mnuFile.Text = "File";
			// 
			// mnuFileOpen
			// 
			this.mnuFileOpen.Index = 0;
			this.mnuFileOpen.Text = "Open...";
			this.mnuFileOpen.Click += new System.EventHandler(this.mnuFileOpen_Click);
			// 
			// mnuFileSave
			// 
			this.mnuFileSave.Index = 1;
			this.mnuFileSave.Text = "Save";
			this.mnuFileSave.Click += new System.EventHandler(this.mnuFileSave_Click);
			// 
			// mnuFileSaveAs
			// 
			this.mnuFileSaveAs.Index = 2;
			this.mnuFileSaveAs.Text = "Save as...";
			this.mnuFileSaveAs.Click += new System.EventHandler(this.mnuFileSaveAs_Click);
			// 
			// mnuFileBar1
			// 
			this.mnuFileBar1.Index = 3;
			this.mnuFileBar1.Text = "-";
			// 
			// mnuFileExit
			// 
			this.mnuFileExit.Index = 4;
			this.mnuFileExit.Text = "Exit";
			this.mnuFileExit.Click += new System.EventHandler(this.mnuFileExit_Click);
			// 
			// mnuEdit
			// 
			this.mnuEdit.Index = 1;
			this.mnuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					this.mnuEditUndo,
																					this.mnuEditRedo,
																					this.mnuEditBar1,
																					this.mnuEditCopy,
																					this.mnuEditCut,
																					this.mnuEditPaste,
																					this.mnuEditBar2,
																					this.mnuEditFind,
																					this.mnuEditFindNext,
																					this.mnuEditBar3,
																					this.mnuEditSelectAll});
			this.mnuEdit.Text = "Edit";
			this.mnuEdit.Popup += new System.EventHandler(this.mnuEdit_Popup);
			// 
			// mnuEditUndo
			// 
			this.mnuEditUndo.Index = 0;
			this.mnuEditUndo.Shortcut = System.Windows.Forms.Shortcut.CtrlZ;
			this.mnuEditUndo.Text = "Undo";
			this.mnuEditUndo.Click += new System.EventHandler(this.mnuEditUndo_Click);
			// 
			// mnuEditRedo
			// 
			this.mnuEditRedo.Index = 1;
			this.mnuEditRedo.Shortcut = System.Windows.Forms.Shortcut.CtrlY;
			this.mnuEditRedo.Text = "Redo";
			this.mnuEditRedo.Click += new System.EventHandler(this.mnuEditRedo_Click);
			// 
			// mnuEditBar1
			// 
			this.mnuEditBar1.Index = 2;
			this.mnuEditBar1.Text = "-";
			// 
			// mnuEditCopy
			// 
			this.mnuEditCopy.Index = 3;
			this.mnuEditCopy.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
			this.mnuEditCopy.Text = "Copy";
			this.mnuEditCopy.Click += new System.EventHandler(this.mnuEditCopy_Click);
			// 
			// mnuEditCut
			// 
			this.mnuEditCut.Index = 4;
			this.mnuEditCut.Shortcut = System.Windows.Forms.Shortcut.CtrlX;
			this.mnuEditCut.Text = "Cut";
			this.mnuEditCut.Click += new System.EventHandler(this.mnuEditCut_Click);
			// 
			// mnuEditPaste
			// 
			this.mnuEditPaste.Index = 5;
			this.mnuEditPaste.Shortcut = System.Windows.Forms.Shortcut.CtrlV;
			this.mnuEditPaste.Text = "Paste";
			this.mnuEditPaste.Click += new System.EventHandler(this.mnuEditPaste_Click);
			// 
			// mnuEditBar2
			// 
			this.mnuEditBar2.Index = 6;
			this.mnuEditBar2.Text = "-";
			// 
			// mnuEditFind
			// 
			this.mnuEditFind.Index = 7;
			this.mnuEditFind.Shortcut = System.Windows.Forms.Shortcut.CtrlF;
			this.mnuEditFind.Text = "Find...";
			this.mnuEditFind.Click += new System.EventHandler(this.mnuEditFind_Click);
			// 
			// mnuEditFindNext
			// 
			this.mnuEditFindNext.Index = 8;
			this.mnuEditFindNext.Shortcut = System.Windows.Forms.Shortcut.F3;
			this.mnuEditFindNext.Text = "Find Next";
			this.mnuEditFindNext.Click += new System.EventHandler(this.mnuEditFindNext_Click);
			// 
			// mnuEditBar3
			// 
			this.mnuEditBar3.Index = 9;
			this.mnuEditBar3.Text = "-";
			// 
			// mnuEditSelectAll
			// 
			this.mnuEditSelectAll.Index = 10;
			this.mnuEditSelectAll.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
			this.mnuEditSelectAll.Text = "Select All";
			this.mnuEditSelectAll.Click += new System.EventHandler(this.mnuEditSelectAll_Click);
			// 
			// mnuStructure
			// 
			this.mnuStructure.Index = 2;
			this.mnuStructure.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.mnuStructureGetTable,
																						 this.mnuStructureRefresh,
																						 this.mnuStructureBar11,
																						 this.mnuStructureTables,
																						 this.mnuStructureViews,
																						 this.mnuStructureBar2,
																						 this.mnuStructureGetRoutine,
																						 this.mnuStructureRefreshRoutinesList,
																						 this.mnuStructrueBar3,
																						 this.mnuStructureStoredPrcedures,
																						 this.mnuStructureFunctions});
			this.mnuStructure.Text = "Structure";
			// 
			// mnuStructureGetTable
			// 
			this.mnuStructureGetTable.Index = 0;
			this.mnuStructureGetTable.Text = "Get table";
			this.mnuStructureGetTable.Click += new System.EventHandler(this.mnuStructureGetTable_Click);
			// 
			// mnuStructureRefresh
			// 
			this.mnuStructureRefresh.Index = 1;
			this.mnuStructureRefresh.Text = "Refresh tables list";
			this.mnuStructureRefresh.Click += new System.EventHandler(this.mnuStructureRefresh_Click);
			// 
			// mnuStructureBar11
			// 
			this.mnuStructureBar11.Index = 2;
			this.mnuStructureBar11.Text = "-";
			// 
			// mnuStructureTables
			// 
			this.mnuStructureTables.Checked = true;
			this.mnuStructureTables.Index = 3;
			this.mnuStructureTables.Text = "Tables";
			this.mnuStructureTables.Click += new System.EventHandler(this.mnuStructureTables_Click);
			// 
			// mnuStructureViews
			// 
			this.mnuStructureViews.Checked = true;
			this.mnuStructureViews.Index = 4;
			this.mnuStructureViews.Text = "Views";
			this.mnuStructureViews.Click += new System.EventHandler(this.mnuStructureViews_Click);
			// 
			// mnuStructureBar2
			// 
			this.mnuStructureBar2.Index = 5;
			this.mnuStructureBar2.Text = "-";
			// 
			// mnuStructureGetRoutine
			// 
			this.mnuStructureGetRoutine.Index = 6;
			this.mnuStructureGetRoutine.Text = "Get routine";
			this.mnuStructureGetRoutine.Click += new System.EventHandler(this.mnuStructureGetRoutine_Click);
			// 
			// mnuStructureRefreshRoutinesList
			// 
			this.mnuStructureRefreshRoutinesList.Index = 7;
			this.mnuStructureRefreshRoutinesList.Text = "Refresh routines list";
			this.mnuStructureRefreshRoutinesList.Click += new System.EventHandler(this.mnuStructureRefreshRoutinesList_Click);
			// 
			// mnuStructrueBar3
			// 
			this.mnuStructrueBar3.Index = 8;
			this.mnuStructrueBar3.Text = "-";
			// 
			// mnuStructureStoredPrcedures
			// 
			this.mnuStructureStoredPrcedures.Checked = true;
			this.mnuStructureStoredPrcedures.Index = 9;
			this.mnuStructureStoredPrcedures.Text = "Stored procedures";
			this.mnuStructureStoredPrcedures.Click += new System.EventHandler(this.mnuStructureStoredPrcedures_Click);
			// 
			// mnuStructureFunctions
			// 
			this.mnuStructureFunctions.Checked = true;
			this.mnuStructureFunctions.Index = 10;
			this.mnuStructureFunctions.Text = "Functions";
			this.mnuStructureFunctions.Click += new System.EventHandler(this.mnuStructureFunctions_Click);
			// 
			// mnuDAC
			// 
			this.mnuDAC.Index = 3;
			this.mnuDAC.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																				   this.mnuDACSimpleDAC,
																				   this.mnuDACSimpleDACOleDb,
																				   this.mnuDACSimpleDACOdbc,
																				   this.mnuDACExecRoutine,
																				   this.mnuDACBar3,
																				   this.mnuDACDataAccessContainer_SQL,
																				   this.mnuDACDataAccessContainer_OleDb,
																				   this.mnuDACDataAccessContainer_Odbc,
																				   this.mnuDACDataAccessComponent_SQL,
																				   this.mnuDACDataAccessComponent_OleDb,
																				   this.mnuDataAccessComponent_Odbc,
																				   this.menuItem3,
																				   this.mnuDACCompile,
																				   this.mnuDACCreateAssembly,
																				   this.mnuDACBar1,
																				   this.mnuDACGenerateResources,
																				   this.mnuDACGenerateSchema});
			this.mnuDAC.Text = ".NET DAC";
			// 
			// mnuDACSimpleDAC
			// 
			this.mnuDACSimpleDAC.Index = 0;
			this.mnuDACSimpleDAC.Text = "Simple DAC (SQL)";
			this.mnuDACSimpleDAC.Click += new System.EventHandler(this.mnuDACSimpleDAC_Click);
			// 
			// mnuDACSimpleDACOleDb
			// 
			this.mnuDACSimpleDACOleDb.Index = 1;
			this.mnuDACSimpleDACOleDb.Text = "Simple DAC (OleDb)";
			this.mnuDACSimpleDACOleDb.Click += new System.EventHandler(this.mnuDACSimpleDACOleDb_Click);
			// 
			// mnuDACSimpleDACOdbc
			// 
			this.mnuDACSimpleDACOdbc.Index = 2;
			this.mnuDACSimpleDACOdbc.Text = "Simple DAC (Odbc)";
			this.mnuDACSimpleDACOdbc.Click += new System.EventHandler(this.mnuDACSimpleDACOdbc_Click);
			// 
			// mnuDACExecRoutine
			// 
			this.mnuDACExecRoutine.Index = 3;
			this.mnuDACExecRoutine.Text = "Exec routine";
			this.mnuDACExecRoutine.Click += new System.EventHandler(this.mnuDACExecRoutine_Click);
			// 
			// mnuDACBar3
			// 
			this.mnuDACBar3.Index = 4;
			this.mnuDACBar3.Text = "-";
			// 
			// mnuDACDataAccessContainer_SQL
			// 
			this.mnuDACDataAccessContainer_SQL.Index = 5;
			this.mnuDACDataAccessContainer_SQL.Text = "DataAccessContainer (SQL)";
			this.mnuDACDataAccessContainer_SQL.Click += new System.EventHandler(this.mnuDACDataAccessContainer_SQL_Click);
			// 
			// mnuDACDataAccessContainer_OleDb
			// 
			this.mnuDACDataAccessContainer_OleDb.Index = 6;
			this.mnuDACDataAccessContainer_OleDb.Text = "DataAccessContainer (OleDb)";
			this.mnuDACDataAccessContainer_OleDb.Click += new System.EventHandler(this.mnuDACDataAccessContainer_OleDb_Click);
			// 
			// mnuDACDataAccessContainer_Odbc
			// 
			this.mnuDACDataAccessContainer_Odbc.Index = 7;
			this.mnuDACDataAccessContainer_Odbc.Text = "DataAccessContainer (Odbc)";
			this.mnuDACDataAccessContainer_Odbc.Click += new System.EventHandler(this.mnuDACDataAccessContainer_Odbc_Click);
			// 
			// mnuDACDataAccessComponent_SQL
			// 
			this.mnuDACDataAccessComponent_SQL.Index = 8;
			this.mnuDACDataAccessComponent_SQL.Text = "DataAccessComponent (SQL)";
			this.mnuDACDataAccessComponent_SQL.Click += new System.EventHandler(this.mnuDACDataAccessComponent_SQL_Click);
			// 
			// mnuDACDataAccessComponent_OleDb
			// 
			this.mnuDACDataAccessComponent_OleDb.Index = 9;
			this.mnuDACDataAccessComponent_OleDb.Text = "DataAccessComponent (OleDb)";
			this.mnuDACDataAccessComponent_OleDb.Click += new System.EventHandler(this.mnuDACDataAccessComponent_OleDb_Click);
			// 
			// mnuDataAccessComponent_Odbc
			// 
			this.mnuDataAccessComponent_Odbc.Index = 10;
			this.mnuDataAccessComponent_Odbc.Text = "DataAccessComponent (Odbc)";
			this.mnuDataAccessComponent_Odbc.Click += new System.EventHandler(this.mnuDataAccessComponent_Odbc_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 11;
			this.menuItem3.Text = "-";
			// 
			// mnuDACCompile
			// 
			this.mnuDACCompile.Index = 12;
			this.mnuDACCompile.Text = "Compile";
			this.mnuDACCompile.Click += new System.EventHandler(this.mnuDACCompile_Click);
			// 
			// mnuDACCreateAssembly
			// 
			this.mnuDACCreateAssembly.Index = 13;
			this.mnuDACCreateAssembly.Text = "Create assembly";
			this.mnuDACCreateAssembly.Click += new System.EventHandler(this.mnuDACCreateAssembly_Click);
			// 
			// mnuDACBar1
			// 
			this.mnuDACBar1.Index = 14;
			this.mnuDACBar1.Text = "-";
			// 
			// mnuDACGenerateResources
			// 
			this.mnuDACGenerateResources.Index = 15;
			this.mnuDACGenerateResources.Text = "Generate resources";
			this.mnuDACGenerateResources.Click += new System.EventHandler(this.mnuDACGenerateResources_Click);
			// 
			// mnuDACGenerateSchema
			// 
			this.mnuDACGenerateSchema.Index = 16;
			this.mnuDACGenerateSchema.Text = "Generate schema";
			this.mnuDACGenerateSchema.Click += new System.EventHandler(this.mnuDACGenerateSchema_Click);
			// 
			// mnuMiscDAC
			// 
			this.mnuMiscDAC.Index = 4;
			this.mnuMiscDAC.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					   this.mnuMiscDACPHPDAC,
																					   this.mnuMiscDACPHPDataAccess,
																					   this.mnuMiscDACVB60DAC,
																					   this.mnuMiscDACVBScriptDAC,
																					   this.mnuMiscDACJScriptDAC});
			this.mnuMiscDAC.Text = "Misc DAC";
			// 
			// mnuMiscDACPHPDAC
			// 
			this.mnuMiscDACPHPDAC.Index = 0;
			this.mnuMiscDACPHPDAC.Text = "PHP DAC";
			this.mnuMiscDACPHPDAC.Click += new System.EventHandler(this.mnuMiscDACPHPDAC_Click);
			// 
			// mnuMiscDACPHPDataAccess
			// 
			this.mnuMiscDACPHPDataAccess.Index = 1;
			this.mnuMiscDACPHPDataAccess.Text = "PHP Data Access";
			this.mnuMiscDACPHPDataAccess.Click += new System.EventHandler(this.mnuMiscDACPHPDataAccess_Click);
			// 
			// mnuMiscDACVB60DAC
			// 
			this.mnuMiscDACVB60DAC.Index = 2;
			this.mnuMiscDACVB60DAC.Text = "VB60 DAC";
			this.mnuMiscDACVB60DAC.Click += new System.EventHandler(this.mnuMiscDACVB60DAC_Click);
			// 
			// mnuMiscDACVBScriptDAC
			// 
			this.mnuMiscDACVBScriptDAC.Index = 3;
			this.mnuMiscDACVBScriptDAC.Text = "VBScript DAC";
			this.mnuMiscDACVBScriptDAC.Click += new System.EventHandler(this.mnuMiscDACVBScriptDAC_Click);
			// 
			// mnuMiscDACJScriptDAC
			// 
			this.mnuMiscDACJScriptDAC.Index = 4;
			this.mnuMiscDACJScriptDAC.Text = "JScript DAC";
			this.mnuMiscDACJScriptDAC.Click += new System.EventHandler(this.mnuMiscDACJScriptDAC_Click);
			// 
			// mnuSp
			// 
			this.mnuSp.Index = 5;
			this.mnuSp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																				  this.mnuSpGenerate,
																				  this.mnuSpSelectByPK,
																				  this.mnuSpSearch,
																				  this.mnuSpSQLCreateTable,
																				  this.mnuSpSQLGenerateInsertRows,
																				  this.mnuSpOtherSqlTemplates,
																				  this.mnuSpParse,
																				  this.mnuSpExecute,
																				  this.mnuSpBar1,
																				  this.mnuSpOracleProcedures,
																				  this.mnuSpBar2,
																				  this.mnuSpfnGetExtendedProperty_fn,
																				  this.mnuSpGetTableColumnsXML_sp,
																				  this.mnuSpGetRoutineParametersXML_sp,
																				  this.mnuSpKeyTables_tbl,
																				  this.mnuSpGET_NEXT_ID_sp});
			this.mnuSp.Text = "SQL";
			// 
			// mnuSpGenerate
			// 
			this.mnuSpGenerate.Index = 0;
			this.mnuSpGenerate.Text = "SQL INSERT, UPDATE, DELETE sp";
			this.mnuSpGenerate.Click += new System.EventHandler(this.mnuSpGenerate_Click);
			// 
			// mnuSpSelectByPK
			// 
			this.mnuSpSelectByPK.Index = 1;
			this.mnuSpSelectByPK.Text = "SELECT sp by PK";
			this.mnuSpSelectByPK.Click += new System.EventHandler(this.mnuSpSelectByPK_Click);
			// 
			// mnuSpSearch
			// 
			this.mnuSpSearch.Index = 2;
			this.mnuSpSearch.Text = "SEARCH sp";
			this.mnuSpSearch.Click += new System.EventHandler(this.mnuSpSearch_Click);
			// 
			// mnuSpSQLCreateTable
			// 
			this.mnuSpSQLCreateTable.Index = 3;
			this.mnuSpSQLCreateTable.Text = "SQL Create table";
			this.mnuSpSQLCreateTable.Click += new System.EventHandler(this.mnuSpSQLCreateTable_Click);
			// 
			// mnuSpSQLGenerateInsertRows
			// 
			this.mnuSpSQLGenerateInsertRows.Index = 4;
			this.mnuSpSQLGenerateInsertRows.Text = "SQL Generate Insert Rows";
			this.mnuSpSQLGenerateInsertRows.Click += new System.EventHandler(this.mnuSpSQLGenerateInsertRows_Click);
			// 
			// mnuSpOtherSqlTemplates
			// 
			this.mnuSpOtherSqlTemplates.Index = 5;
			this.mnuSpOtherSqlTemplates.Text = "Other sql templates...";
			this.mnuSpOtherSqlTemplates.Click += new System.EventHandler(this.mnuSpOtherSqlTemplates_Click);
			// 
			// mnuSpParse
			// 
			this.mnuSpParse.Index = 6;
			this.mnuSpParse.Text = "Parse";
			this.mnuSpParse.Click += new System.EventHandler(this.mnuSpParse_Click);
			// 
			// mnuSpExecute
			// 
			this.mnuSpExecute.Index = 7;
			this.mnuSpExecute.Text = "Execute";
			this.mnuSpExecute.Click += new System.EventHandler(this.mnuSpExecute_Click);
			// 
			// mnuSpBar1
			// 
			this.mnuSpBar1.Index = 8;
			this.mnuSpBar1.Text = "-";
			// 
			// mnuSpOracleProcedures
			// 
			this.mnuSpOracleProcedures.Index = 9;
			this.mnuSpOracleProcedures.Text = "Oracle INSERT, UPDATE, DELETE sp";
			this.mnuSpOracleProcedures.Click += new System.EventHandler(this.mnuSpOracleProcedures_Click);
			// 
			// mnuSpBar2
			// 
			this.mnuSpBar2.Index = 10;
			this.mnuSpBar2.Text = "-";
			// 
			// mnuSpfnGetExtendedProperty_fn
			// 
			this.mnuSpfnGetExtendedProperty_fn.Index = 11;
			this.mnuSpfnGetExtendedProperty_fn.Text = "fnGetExtendedProperty fn";
			this.mnuSpfnGetExtendedProperty_fn.Click += new System.EventHandler(this.mnuSpfnGetExtendedProperty_fn_Click);
			// 
			// mnuSpGetTableColumnsXML_sp
			// 
			this.mnuSpGetTableColumnsXML_sp.Index = 12;
			this.mnuSpGetTableColumnsXML_sp.Text = "GetTableColumnsXML sp";
			this.mnuSpGetTableColumnsXML_sp.Click += new System.EventHandler(this.mnuSpGetTableColumnsXML_sp_Click);
			// 
			// mnuSpGetRoutineParametersXML_sp
			// 
			this.mnuSpGetRoutineParametersXML_sp.Index = 13;
			this.mnuSpGetRoutineParametersXML_sp.Text = "GetRoutineParametersXML sp";
			this.mnuSpGetRoutineParametersXML_sp.Click += new System.EventHandler(this.mnuSpGetRoutineParametersXML_sp_Click);
			// 
			// mnuSpKeyTables_tbl
			// 
			this.mnuSpKeyTables_tbl.Index = 14;
			this.mnuSpKeyTables_tbl.Text = "KeyTables tbl";
			this.mnuSpKeyTables_tbl.Click += new System.EventHandler(this.mnuSpKeyTables_tbl_Click);
			// 
			// mnuSpGET_NEXT_ID_sp
			// 
			this.mnuSpGET_NEXT_ID_sp.Index = 15;
			this.mnuSpGET_NEXT_ID_sp.Text = "GET_NEXT_ID sp";
			this.mnuSpGET_NEXT_ID_sp.Click += new System.EventHandler(this.mnuSpGET_NEXT_ID_sp_Click);
			// 
			// mnuUI
			// 
			this.mnuUI.Index = 6;
			this.mnuUI.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																				  this.mnuUIGenerateWebForm,
																				  this.mnuUIGenerateWebUserControl,
																				  this.mnuUIGenerateHTML,
																				  this.mnuUIGenerateWindowsForm_resx,
																				  this.mnuUISep1,
																				  this.mnuUISimpleDAC,
																				  this.mnuUISimpleDACMethods_win});
			this.mnuUI.Text = "UI";
			// 
			// mnuUIGenerateWebForm
			// 
			this.mnuUIGenerateWebForm.Index = 0;
			this.mnuUIGenerateWebForm.Text = "Generate WebForm";
			this.mnuUIGenerateWebForm.Click += new System.EventHandler(this.mnuUIGenerateWebForm_Click);
			// 
			// mnuUIGenerateWebUserControl
			// 
			this.mnuUIGenerateWebUserControl.Index = 1;
			this.mnuUIGenerateWebUserControl.Text = "Generate Web User Control";
			this.mnuUIGenerateWebUserControl.Click += new System.EventHandler(this.mnuUIGenerateWebUserControl_Click);
			// 
			// mnuUIGenerateHTML
			// 
			this.mnuUIGenerateHTML.Index = 2;
			this.mnuUIGenerateHTML.Text = "Generate HTML";
			this.mnuUIGenerateHTML.Click += new System.EventHandler(this.mnuUIGenerateHTML_Click);
			// 
			// mnuUIGenerateWindowsForm_resx
			// 
			this.mnuUIGenerateWindowsForm_resx.Index = 3;
			this.mnuUIGenerateWindowsForm_resx.Text = "Generate Windows Form (resx)";
			this.mnuUIGenerateWindowsForm_resx.Click += new System.EventHandler(this.mnuUIGenerateWindowsForm_resx_Click);
			// 
			// mnuUISep1
			// 
			this.mnuUISep1.Index = 4;
			this.mnuUISep1.Text = "-";
			// 
			// mnuUISimpleDAC
			// 
			this.mnuUISimpleDAC.Index = 5;
			this.mnuUISimpleDAC.Text = "Simple DAC UI Methods (Web)";
			this.mnuUISimpleDAC.Click += new System.EventHandler(this.mnuUISimpleDAC_Click);
			// 
			// mnuUISimpleDACMethods_win
			// 
			this.mnuUISimpleDACMethods_win.Index = 6;
			this.mnuUISimpleDACMethods_win.Text = "Simple DAC UI Methods (Windows)";
			this.mnuUISimpleDACMethods_win.Click += new System.EventHandler(this.mnuUISimpleDACMethods_win_Click);
			// 
			// mnuCustomFields
			// 
			this.mnuCustomFields.Index = 7;
			this.mnuCustomFields.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																							this.mnuCustomFieldsDBEntities,
																							this.mnuCustomFieldsDACentities,
																							this.mnuCustomFieldsManagement,
																							this.mnuCustomFieldsGenerateView,
																							this.mnuCustomFieldsGenerateRead_sp,
																							this.mnuCustomFieldsGenerateClass});
			this.mnuCustomFields.Text = "Custom fields";
			// 
			// mnuCustomFieldsDBEntities
			// 
			this.mnuCustomFieldsDBEntities.Index = 0;
			this.mnuCustomFieldsDBEntities.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																									  this.mnuCustomFieldsTable_tbl,
																									  this.mnuCustomFieldsTable_sp,
																									  this.mnuCustomFieldsTableColumn_tbl,
																									  this.mnuCustomFieldsTableColumn_sp,
																									  this.mnuCustomFieldsType_tbl,
																									  this.mnuCustomFieldsType_sp,
																									  this.mnuCustomFieldsSecurity_tbl,
																									  this.mnuCustomFieldsSecurity_sp,
																									  this.mnuCustomFieldsPropertyList_tbl,
																									  this.mnuCustomFieldsPropertyList_sp,
																									  this.mnuCustomFieldsProperty_tbl,
																									  this.mnuCustomFieldsProperty_sp,
																									  this.mnuCustomFieldsValueList_tbl,
																									  this.mnuCustomFieldsValueList_sp,
																									  this.mnuCustomFieldsValuesBool_tbl,
																									  this.mnuCustomFieldsValuesBool_sp,
																									  this.mnuCustomFieldsValuesDateTime_tbl,
																									  this.mnuCustomFieldsValuesDateTime_sp,
																									  this.mnuCustomFieldsValuesDecimal_tbl,
																									  this.mnuCustomFieldsValuesDecimal_sp,
																									  this.mnuCustomFieldsValuesInteger_tbl,
																									  this.mnuCustomFieldsValuesInteger_sp,
																									  this.mnuCustomFieldsValuesString_tbl,
																									  this.mnuCustomFieldsValuesString_sp,
																									  this.mnuCustomFieldsBar1,
																									  this.mnuCustomFieldsGetPropertyListValues_fn,
																									  this.mnuCustomFieldsGetTableCustomFieldsXML_sp,
																									  this.mnuCustomFieldsValues_DELETE_sp,
																									  this.mnuCustomFieldsCustomFieldsTableColumn_SELECT_ByFKTable_sp,
																									  this.mnuCustomFieldsDBEntitiesCustomFieldsTable_SELECT_ByName_sp,
																									  this.mnuCustomFieldsGetPrimaryKeyColumnName_sp,
																									  this.mnuCustomFieldsDBEntitiesBar2,
																									  this.mnuCustomFieldsDBEntitiesAll,
																									  this.mnuCustomFieldsCustomFieldsType_insert});
			this.mnuCustomFieldsDBEntities.Text = "DB Entities";
			// 
			// mnuCustomFieldsTable_tbl
			// 
			this.mnuCustomFieldsTable_tbl.Index = 0;
			this.mnuCustomFieldsTable_tbl.Text = "CustomFieldsTable table";
			this.mnuCustomFieldsTable_tbl.Click += new System.EventHandler(this.mnuCustomFieldsTable_tbl_Click);
			// 
			// mnuCustomFieldsTable_sp
			// 
			this.mnuCustomFieldsTable_sp.Index = 1;
			this.mnuCustomFieldsTable_sp.Text = "CustomFieldsTable sp";
			this.mnuCustomFieldsTable_sp.Click += new System.EventHandler(this.mnuCustomFieldsTable_sp_Click);
			// 
			// mnuCustomFieldsTableColumn_tbl
			// 
			this.mnuCustomFieldsTableColumn_tbl.Index = 2;
			this.mnuCustomFieldsTableColumn_tbl.Text = "CustomFieldsTableColumn table";
			this.mnuCustomFieldsTableColumn_tbl.Click += new System.EventHandler(this.mnuCustomFieldsTableColumn_tbl_Click);
			// 
			// mnuCustomFieldsTableColumn_sp
			// 
			this.mnuCustomFieldsTableColumn_sp.Index = 3;
			this.mnuCustomFieldsTableColumn_sp.Text = "CustomFieldsTableColumn sp";
			this.mnuCustomFieldsTableColumn_sp.Click += new System.EventHandler(this.mnuCustomFieldsTableColumn_sp_Click);
			// 
			// mnuCustomFieldsType_tbl
			// 
			this.mnuCustomFieldsType_tbl.Index = 4;
			this.mnuCustomFieldsType_tbl.Text = "CustomFieldsType table";
			this.mnuCustomFieldsType_tbl.Click += new System.EventHandler(this.mnuCustomFieldsType_tbl_Click);
			// 
			// mnuCustomFieldsType_sp
			// 
			this.mnuCustomFieldsType_sp.Index = 5;
			this.mnuCustomFieldsType_sp.Text = "CustomFieldsType sp";
			this.mnuCustomFieldsType_sp.Click += new System.EventHandler(this.mnuCustomFieldsType_sp_Click);
			// 
			// mnuCustomFieldsSecurity_tbl
			// 
			this.mnuCustomFieldsSecurity_tbl.Index = 6;
			this.mnuCustomFieldsSecurity_tbl.Text = "CustomFieldsSecurity table";
			this.mnuCustomFieldsSecurity_tbl.Click += new System.EventHandler(this.mnuCustomFieldsSecurity_tbl_Click);
			// 
			// mnuCustomFieldsSecurity_sp
			// 
			this.mnuCustomFieldsSecurity_sp.Index = 7;
			this.mnuCustomFieldsSecurity_sp.Text = "CustomFieldsSecurity sp";
			this.mnuCustomFieldsSecurity_sp.Click += new System.EventHandler(this.mnuCustomFieldsSecurity_sp_Click);
			// 
			// mnuCustomFieldsPropertyList_tbl
			// 
			this.mnuCustomFieldsPropertyList_tbl.Index = 8;
			this.mnuCustomFieldsPropertyList_tbl.Text = "CustomFieldsPropertyList table";
			this.mnuCustomFieldsPropertyList_tbl.Click += new System.EventHandler(this.mnuCustomFieldsPropertyList_tbl_Click);
			// 
			// mnuCustomFieldsPropertyList_sp
			// 
			this.mnuCustomFieldsPropertyList_sp.Index = 9;
			this.mnuCustomFieldsPropertyList_sp.Text = "CustomFieldsPropertyList sp";
			this.mnuCustomFieldsPropertyList_sp.Click += new System.EventHandler(this.mnuCustomFieldsPropertyList_sp_Click);
			// 
			// mnuCustomFieldsProperty_tbl
			// 
			this.mnuCustomFieldsProperty_tbl.Index = 10;
			this.mnuCustomFieldsProperty_tbl.Text = "CustomFieldsProperty table";
			this.mnuCustomFieldsProperty_tbl.Click += new System.EventHandler(this.mnuCustomFieldsProperty_tbl_Click);
			// 
			// mnuCustomFieldsProperty_sp
			// 
			this.mnuCustomFieldsProperty_sp.Index = 11;
			this.mnuCustomFieldsProperty_sp.Text = "CustomFieldsProperty sp";
			this.mnuCustomFieldsProperty_sp.Click += new System.EventHandler(this.mnuCustomFieldsProperty_sp_Click);
			// 
			// mnuCustomFieldsValueList_tbl
			// 
			this.mnuCustomFieldsValueList_tbl.Index = 12;
			this.mnuCustomFieldsValueList_tbl.Text = "CustomFieldsValueList table";
			this.mnuCustomFieldsValueList_tbl.Click += new System.EventHandler(this.mnuCustomFieldsValueList_tbl_Click);
			// 
			// mnuCustomFieldsValueList_sp
			// 
			this.mnuCustomFieldsValueList_sp.Index = 13;
			this.mnuCustomFieldsValueList_sp.Text = "CustomFieldsValueList sp";
			this.mnuCustomFieldsValueList_sp.Click += new System.EventHandler(this.mnuCustomFieldsValueList_sp_Click);
			// 
			// mnuCustomFieldsValuesBool_tbl
			// 
			this.mnuCustomFieldsValuesBool_tbl.Index = 14;
			this.mnuCustomFieldsValuesBool_tbl.Text = "CustomFieldsValuesBool table";
			this.mnuCustomFieldsValuesBool_tbl.Click += new System.EventHandler(this.mnuCustomFieldsValuesBool_tbl_Click);
			// 
			// mnuCustomFieldsValuesBool_sp
			// 
			this.mnuCustomFieldsValuesBool_sp.Index = 15;
			this.mnuCustomFieldsValuesBool_sp.Text = "CustomFieldsValuesBool sp";
			this.mnuCustomFieldsValuesBool_sp.Click += new System.EventHandler(this.mnuCustomFieldsValuesBool_sp_Click);
			// 
			// mnuCustomFieldsValuesDateTime_tbl
			// 
			this.mnuCustomFieldsValuesDateTime_tbl.Index = 16;
			this.mnuCustomFieldsValuesDateTime_tbl.Text = "CustomFieldsValuesDateTime table";
			this.mnuCustomFieldsValuesDateTime_tbl.Click += new System.EventHandler(this.mnuCustomFieldsValuesDateTime_tbl_Click);
			// 
			// mnuCustomFieldsValuesDateTime_sp
			// 
			this.mnuCustomFieldsValuesDateTime_sp.Index = 17;
			this.mnuCustomFieldsValuesDateTime_sp.Text = "CustomFieldsValuesDateTime sp";
			this.mnuCustomFieldsValuesDateTime_sp.Click += new System.EventHandler(this.mnuCustomFieldsValuesDateTime_sp_Click);
			// 
			// mnuCustomFieldsValuesDecimal_tbl
			// 
			this.mnuCustomFieldsValuesDecimal_tbl.Index = 18;
			this.mnuCustomFieldsValuesDecimal_tbl.Text = "CustomFieldsValuesDecimal table";
			this.mnuCustomFieldsValuesDecimal_tbl.Click += new System.EventHandler(this.mnuCustomFieldsValuesDecimal_tbl_Click);
			// 
			// mnuCustomFieldsValuesDecimal_sp
			// 
			this.mnuCustomFieldsValuesDecimal_sp.Index = 19;
			this.mnuCustomFieldsValuesDecimal_sp.Text = "CustomFieldsValuesDecimal sp";
			this.mnuCustomFieldsValuesDecimal_sp.Click += new System.EventHandler(this.mnuCustomFieldsValuesDecimal_sp_Click);
			// 
			// mnuCustomFieldsValuesInteger_tbl
			// 
			this.mnuCustomFieldsValuesInteger_tbl.Index = 20;
			this.mnuCustomFieldsValuesInteger_tbl.Text = "CustomFieldsValuesInteger table";
			this.mnuCustomFieldsValuesInteger_tbl.Click += new System.EventHandler(this.mnuCustomFieldsValuesInteger_tbl_Click);
			// 
			// mnuCustomFieldsValuesInteger_sp
			// 
			this.mnuCustomFieldsValuesInteger_sp.Index = 21;
			this.mnuCustomFieldsValuesInteger_sp.Text = "CustomFieldsValuesInteger sp";
			this.mnuCustomFieldsValuesInteger_sp.Click += new System.EventHandler(this.mnuCustomFieldsValuesInteger_sp_Click);
			// 
			// mnuCustomFieldsValuesString_tbl
			// 
			this.mnuCustomFieldsValuesString_tbl.Index = 22;
			this.mnuCustomFieldsValuesString_tbl.Text = "CustomFieldsValuesString table";
			this.mnuCustomFieldsValuesString_tbl.Click += new System.EventHandler(this.mnuCustomFieldsValuesString_tbl_Click);
			// 
			// mnuCustomFieldsValuesString_sp
			// 
			this.mnuCustomFieldsValuesString_sp.Index = 23;
			this.mnuCustomFieldsValuesString_sp.Text = "CustomFieldsValuesString sp";
			this.mnuCustomFieldsValuesString_sp.Click += new System.EventHandler(this.mnuCustomFieldsValuesString_sp_Click);
			// 
			// mnuCustomFieldsBar1
			// 
			this.mnuCustomFieldsBar1.Index = 24;
			this.mnuCustomFieldsBar1.Text = "-";
			// 
			// mnuCustomFieldsGetPropertyListValues_fn
			// 
			this.mnuCustomFieldsGetPropertyListValues_fn.Index = 25;
			this.mnuCustomFieldsGetPropertyListValues_fn.Text = "GetPropertyListValues fn";
			this.mnuCustomFieldsGetPropertyListValues_fn.Click += new System.EventHandler(this.mnuCustomFieldsGetPropertyListValues_fn_Click);
			// 
			// mnuCustomFieldsGetTableCustomFieldsXML_sp
			// 
			this.mnuCustomFieldsGetTableCustomFieldsXML_sp.Index = 26;
			this.mnuCustomFieldsGetTableCustomFieldsXML_sp.Text = "GetTableCustomFieldsXML sp";
			this.mnuCustomFieldsGetTableCustomFieldsXML_sp.Click += new System.EventHandler(this.mnuCustomFieldsGetTableCustomFieldsXML_sp_Click);
			// 
			// mnuCustomFieldsValues_DELETE_sp
			// 
			this.mnuCustomFieldsValues_DELETE_sp.Index = 27;
			this.mnuCustomFieldsValues_DELETE_sp.Text = "CustomFieldsValues_DELETE sp";
			this.mnuCustomFieldsValues_DELETE_sp.Click += new System.EventHandler(this.mnuCustomFieldsValues_DELETE_sp_Click);
			// 
			// mnuCustomFieldsCustomFieldsTableColumn_SELECT_ByFKTable_sp
			// 
			this.mnuCustomFieldsCustomFieldsTableColumn_SELECT_ByFKTable_sp.Index = 28;
			this.mnuCustomFieldsCustomFieldsTableColumn_SELECT_ByFKTable_sp.Text = "CustomFieldsTableColumn_SELECT_ByFKTable sp";
			this.mnuCustomFieldsCustomFieldsTableColumn_SELECT_ByFKTable_sp.Click += new System.EventHandler(this.mnuCustomFieldsCustomFieldsTableColumn_SELECT_ByFKTable_sp_Click);
			// 
			// mnuCustomFieldsDBEntitiesCustomFieldsTable_SELECT_ByName_sp
			// 
			this.mnuCustomFieldsDBEntitiesCustomFieldsTable_SELECT_ByName_sp.Index = 29;
			this.mnuCustomFieldsDBEntitiesCustomFieldsTable_SELECT_ByName_sp.Text = "CustomFieldsTable_SELECT_ByName sp";
			this.mnuCustomFieldsDBEntitiesCustomFieldsTable_SELECT_ByName_sp.Click += new System.EventHandler(this.mnuCustomFieldsDBEntitiesCustomFieldsTable_SELECT_ByName_sp_Click);
			// 
			// mnuCustomFieldsGetPrimaryKeyColumnName_sp
			// 
			this.mnuCustomFieldsGetPrimaryKeyColumnName_sp.Index = 30;
			this.mnuCustomFieldsGetPrimaryKeyColumnName_sp.Text = "GetPrimaryKeyColumnName sp";
			this.mnuCustomFieldsGetPrimaryKeyColumnName_sp.Click += new System.EventHandler(this.mnuCustomFieldsGetPrimaryKeyColumnName_sp_Click);
			// 
			// mnuCustomFieldsDBEntitiesBar2
			// 
			this.mnuCustomFieldsDBEntitiesBar2.Index = 31;
			this.mnuCustomFieldsDBEntitiesBar2.Text = "-";
			// 
			// mnuCustomFieldsDBEntitiesAll
			// 
			this.mnuCustomFieldsDBEntitiesAll.Index = 32;
			this.mnuCustomFieldsDBEntitiesAll.Text = "All";
			this.mnuCustomFieldsDBEntitiesAll.Click += new System.EventHandler(this.mnuCustomFieldsDBEntitiesAll_Click);
			// 
			// mnuCustomFieldsCustomFieldsType_insert
			// 
			this.mnuCustomFieldsCustomFieldsType_insert.Index = 33;
			this.mnuCustomFieldsCustomFieldsType_insert.Text = "Insert custom fields types";
			this.mnuCustomFieldsCustomFieldsType_insert.Click += new System.EventHandler(this.mnuCustomFieldsCustomFieldsType_insert_Click);
			// 
			// mnuCustomFieldsDACentities
			// 
			this.mnuCustomFieldsDACentities.Index = 1;
			this.mnuCustomFieldsDACentities.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																									   this.mnuCustomFieldsValuesBool_DAC,
																									   this.mnuCustomFieldsValuesDateTime_DAC,
																									   this.mnuCustomFieldsValuesDecimal_DAC,
																									   this.mnuCustomFieldsValuesInteger_DAC,
																									   this.mnuCustomFieldsValuesString_DAC,
																									   this.mnuCustomFieldsDACEntitiesBar1,
																									   this.mnuCustomFieldsDACEntitiesUtil});
			this.mnuCustomFieldsDACentities.Text = "DAC Entities";
			// 
			// mnuCustomFieldsValuesBool_DAC
			// 
			this.mnuCustomFieldsValuesBool_DAC.Index = 0;
			this.mnuCustomFieldsValuesBool_DAC.Text = "CustomFieldsValuesBool";
			this.mnuCustomFieldsValuesBool_DAC.Click += new System.EventHandler(this.mnuCustomFieldsValuesBool_DAC_Click);
			// 
			// mnuCustomFieldsValuesDateTime_DAC
			// 
			this.mnuCustomFieldsValuesDateTime_DAC.Index = 1;
			this.mnuCustomFieldsValuesDateTime_DAC.Text = "CustomFieldsValuesDateTime";
			this.mnuCustomFieldsValuesDateTime_DAC.Click += new System.EventHandler(this.mnuCustomFieldsValuesDateTime_DAC_Click);
			// 
			// mnuCustomFieldsValuesDecimal_DAC
			// 
			this.mnuCustomFieldsValuesDecimal_DAC.Index = 2;
			this.mnuCustomFieldsValuesDecimal_DAC.Text = "CustomFieldsValuesDecimal";
			this.mnuCustomFieldsValuesDecimal_DAC.Click += new System.EventHandler(this.mnuCustomFieldsValuesDecimal_DAC_Click);
			// 
			// mnuCustomFieldsValuesInteger_DAC
			// 
			this.mnuCustomFieldsValuesInteger_DAC.Index = 3;
			this.mnuCustomFieldsValuesInteger_DAC.Text = "CustomFieldsValuesInteger";
			this.mnuCustomFieldsValuesInteger_DAC.Click += new System.EventHandler(this.mnuCustomFieldsValuesInteger_DAC_Click);
			// 
			// mnuCustomFieldsValuesString_DAC
			// 
			this.mnuCustomFieldsValuesString_DAC.Index = 4;
			this.mnuCustomFieldsValuesString_DAC.Text = "CustomFieldsValuesString";
			this.mnuCustomFieldsValuesString_DAC.Click += new System.EventHandler(this.mnuCustomFieldsValuesString_DAC_Click);
			// 
			// mnuCustomFieldsDACEntitiesBar1
			// 
			this.mnuCustomFieldsDACEntitiesBar1.Index = 5;
			this.mnuCustomFieldsDACEntitiesBar1.Text = "-";
			// 
			// mnuCustomFieldsDACEntitiesUtil
			// 
			this.mnuCustomFieldsDACEntitiesUtil.Index = 6;
			this.mnuCustomFieldsDACEntitiesUtil.Text = "Util";
			this.mnuCustomFieldsDACEntitiesUtil.Click += new System.EventHandler(this.mnuCustomFieldsDACEntitiesUtil_Click);
			// 
			// mnuCustomFieldsManagement
			// 
			this.mnuCustomFieldsManagement.Index = 2;
			this.mnuCustomFieldsManagement.Text = "Management...";
			this.mnuCustomFieldsManagement.Click += new System.EventHandler(this.mnuCustomFieldsManagement_Click);
			// 
			// mnuCustomFieldsGenerateView
			// 
			this.mnuCustomFieldsGenerateView.Index = 3;
			this.mnuCustomFieldsGenerateView.Text = "Generate view";
			this.mnuCustomFieldsGenerateView.Click += new System.EventHandler(this.mnuCustomFieldsGenerateView_Click);
			// 
			// mnuCustomFieldsGenerateRead_sp
			// 
			this.mnuCustomFieldsGenerateRead_sp.Index = 4;
			this.mnuCustomFieldsGenerateRead_sp.Text = "Generate read sp";
			this.mnuCustomFieldsGenerateRead_sp.Click += new System.EventHandler(this.mnuCustomFieldsGenerateRead_sp_Click);
			// 
			// mnuCustomFieldsGenerateClass
			// 
			this.mnuCustomFieldsGenerateClass.Index = 5;
			this.mnuCustomFieldsGenerateClass.Text = "Generate class";
			this.mnuCustomFieldsGenerateClass.Click += new System.EventHandler(this.mnuCustomFieldsGenerateClass_Click);
			// 
			// mnuTools
			// 
			this.mnuTools.Index = 8;
			this.mnuTools.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.mnuToolsClearErrors,
																					 this.mnuToolsApplyColorCoding,
																					 this.mnuToolsFont,
																					 this.mnuToolsClearText,
																					 this.mnuToolsDACExample,
																					 this.mnuToolsGetXML,
																					 this.mnuToolsSep1,
																					 this.mnuToolsNewConnection,
																					 this.mnuToolsConnectionStrings});
			this.mnuTools.Text = "Tools";
			// 
			// mnuToolsClearErrors
			// 
			this.mnuToolsClearErrors.Index = 0;
			this.mnuToolsClearErrors.Text = "Clear errors";
			this.mnuToolsClearErrors.Click += new System.EventHandler(this.mnuToolsClearErrors_Click);
			// 
			// mnuToolsApplyColorCoding
			// 
			this.mnuToolsApplyColorCoding.Index = 1;
			this.mnuToolsApplyColorCoding.Text = "Apply color coding";
			this.mnuToolsApplyColorCoding.Click += new System.EventHandler(this.mnuToolsApplyColorCoding_Click);
			// 
			// mnuToolsFont
			// 
			this.mnuToolsFont.Index = 2;
			this.mnuToolsFont.Text = "Font...";
			this.mnuToolsFont.Click += new System.EventHandler(this.mnuToolsFont_Click);
			// 
			// mnuToolsClearText
			// 
			this.mnuToolsClearText.Index = 3;
			this.mnuToolsClearText.Text = "Clear text";
			this.mnuToolsClearText.Click += new System.EventHandler(this.mnuToolsClearText_Click);
			// 
			// mnuToolsDACExample
			// 
			this.mnuToolsDACExample.Index = 4;
			this.mnuToolsDACExample.Text = "DAC Example";
			this.mnuToolsDACExample.Click += new System.EventHandler(this.mnuToolsDACExample_Click);
			// 
			// mnuToolsSep1
			// 
			this.mnuToolsSep1.Index = 6;
			this.mnuToolsSep1.Text = "-";
			// 
			// mnuToolsNewConnection
			// 
			this.mnuToolsNewConnection.Index = 7;
			this.mnuToolsNewConnection.Text = "New Connection...";
			this.mnuToolsNewConnection.Click += new System.EventHandler(this.mnuToolsNewConnection_Click);
			// 
			// mnuToolsConnectionStrings
			// 
			this.mnuToolsConnectionStrings.Index = 8;
			this.mnuToolsConnectionStrings.Text = "Connection strings";
			// 
			// statusBar1
			// 
			this.statusBar1.Location = new System.Drawing.Point(0, 471);
			this.statusBar1.Name = "statusBar1";
			this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
																						  this.sbPanelCurrentFile,
																						  this.sbPanelAssembly});
			this.statusBar1.ShowPanels = true;
			this.statusBar1.Size = new System.Drawing.Size(912, 22);
			this.statusBar1.TabIndex = 14;
			// 
			// sbPanelCurrentFile
			// 
			this.sbPanelCurrentFile.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
			this.sbPanelCurrentFile.MinWidth = 100;
			// 
			// sbPanelAssembly
			// 
			this.sbPanelAssembly.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
			this.sbPanelAssembly.MinWidth = 100;
			// 
			// cboOptAssemblies
			// 
			this.cboOptAssemblies.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.cboOptAssemblies.Location = new System.Drawing.Point(475, 4);
			this.cboOptAssemblies.Name = "cboOptAssemblies";
			this.cboOptAssemblies.Size = new System.Drawing.Size(357, 21);
			this.cboOptAssemblies.TabIndex = 15;
			this.cboOptAssemblies.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cboOptAssemblies_KeyDown);
			this.cboOptAssemblies.TextChanged += new System.EventHandler(this.cboOptAssemblies_TextChanged);
			// 
			// btnOpAssembliesAdd
			// 
			this.btnOpAssembliesAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.btnOpAssembliesAdd.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnOpAssembliesAdd.Image = ((System.Drawing.Image)(resources.GetObject("btnOpAssembliesAdd.Image")));
			this.btnOpAssembliesAdd.Location = new System.Drawing.Point(856, 3);
			this.btnOpAssembliesAdd.Name = "btnOpAssembliesAdd";
			this.btnOpAssembliesAdd.Size = new System.Drawing.Size(24, 23);
			this.btnOpAssembliesAdd.TabIndex = 16;
			this.btnOpAssembliesAdd.Click += new System.EventHandler(this.btnOpAssembliesAdd_Click);
			// 
			// btnOptAssembliesDelete
			// 
			this.btnOptAssembliesDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.btnOptAssembliesDelete.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnOptAssembliesDelete.Image = ((System.Drawing.Image)(resources.GetObject("btnOptAssembliesDelete.Image")));
			this.btnOptAssembliesDelete.Location = new System.Drawing.Point(880, 3);
			this.btnOptAssembliesDelete.Name = "btnOptAssembliesDelete";
			this.btnOptAssembliesDelete.Size = new System.Drawing.Size(24, 23);
			this.btnOptAssembliesDelete.TabIndex = 17;
			this.btnOptAssembliesDelete.Click += new System.EventHandler(this.btnOptAssembliesDelete_Click);
			// 
			// btnOpStandardAssemblies
			// 
			this.btnOpStandardAssemblies.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.btnOpStandardAssemblies.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnOpStandardAssemblies.Image = ((System.Drawing.Image)(resources.GetObject("btnOpStandardAssemblies.Image")));
			this.btnOpStandardAssemblies.Location = new System.Drawing.Point(832, 3);
			this.btnOpStandardAssemblies.Name = "btnOpStandardAssemblies";
			this.btnOpStandardAssemblies.Size = new System.Drawing.Size(24, 23);
			this.btnOpStandardAssemblies.TabIndex = 18;
			this.btnOpStandardAssemblies.Click += new System.EventHandler(this.btnOpStandardAssemblies_Click);
			// 
			// mnuToolsGetXML
			// 
			this.mnuToolsGetXML.Index = 5;
			this.mnuToolsGetXML.Text = "Get XML";
			this.mnuToolsGetXML.Click += new System.EventHandler(this.mnuToolsGetXML_Click);
			// 
			// BForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(912, 493);
			this.Controls.Add(this.btnOpStandardAssemblies);
			this.Controls.Add(this.btnOptAssembliesDelete);
			this.Controls.Add(this.btnOpAssembliesAdd);
			this.Controls.Add(this.cboOptAssemblies);
			this.Controls.Add(this.statusBar1);
			this.Controls.Add(this.cboTables);
			this.Controls.Add(this.lblLanguage);
			this.Controls.Add(this.lblTable);
			this.Controls.Add(this.panel1);
			this.Controls.Add(this.cboLanguages);
			this.Menu = this.mainMenu;
			this.Name = "BForm";
			this.Text = "DACBuilder";
			this.Closing += new System.ComponentModel.CancelEventHandler(this.BForm_Closing);
			this.Load += new System.EventHandler(this.BForm_Load);
			this.panel1.ResumeLayout(false);
			this.panel3.ResumeLayout(false);
			this.panel2.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dgColumns)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.sbPanelCurrentFile)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.sbPanelAssembly)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion


		#region Form_Load

		private void BForm_Load(object sender, System.EventArgs e)
		{
			InitializeTextCode();
			FillComboTables();
			string[] langs = Enum.GetNames(typeof(LanguageType));
			for(int i = 0; i < langs.Length; i++)
				cboLanguages.Items.Add(langs[i]);
			cboLanguages.SelectedIndex = 0;

			// Create the ToolTip and associate with the Form container.
			toolTip1 = new ToolTip();

			// Set up the delays for the ToolTip.
			toolTip1.AutoPopDelay = 5000;
			toolTip1.InitialDelay = 1000;
			toolTip1.ReshowDelay = 500;
			// Force the ToolTip text to be displayed whether or not the form is active.
			toolTip1.ShowAlways = true;
			SetOperationsListToolTip();
			LoadStandardAssemblies();
			SetControls();
			CreateConnectionStringsMenu();
		}

		#endregion

		#region Functions

		private void SetControls()
		{
			mnuStructureGetRoutine.Enabled 
				= mnuStructureRefreshRoutinesList.Enabled
				= mnuStructureFunctions.Enabled
				= mnuStructureStoredPrcedures.Enabled
				= (dbType == DBTypes.SQL);
		}

		private void InitializeTextCode()
		{
			txtCode.AutoWordSelection = true;
			txtCode.ShowSelectionMargin = true;

			searchParams.FindWhat = string.Empty;
			searchParams.SearchStart = 0;
			searchParams.SearchEnd = -1;
			searchParams.FindOptions = RichTextBoxFinds.None;
		}

		private void GenerateDAC(string rmdbsTemplate)
		{
			XmlDocument doc = new XmlDocument();
			doc.LoadXml(dsTable.GetXml());
			string tableName = doc.DocumentElement.GetAttribute("name");
			CommonGenerator DACGen = new CommonGenerator(tableName, doc, (LanguageType)cboLanguages.SelectedIndex);
			if(PrepareXslParameters(rmdbsTemplate))
			{
				DACGen.Generate(rmdbsTemplate, xslParametersDoc);
				txtCode.Text = DACGen.CommonCode;
				CurrentFile = string.Empty;
				if(CommonGenerator.ErrorMessages.Count > 0)
				{
					foreach(string sErr in CommonGenerator.ErrorMessages)
					{
						DotNetScriptEngineError err = new DotNetScriptEngineError(sErr);
						AddError(err);
					}
				}
			}
		}


		private void GetStructure()
		{
			try
			{
				if(cboTables.SelectedIndex >= 0)
				{
					DBHelper dbH = new DBHelper(ConnectionString, dbType);
					XmlDocument doc = dbH.GetTableStructure(cboTables.SelectedValue.ToString()); //DACGen.GetTableStructure();
#if DEBUG
					doc.Save(Application.StartupPath + "\\Templates\\" + cboTables.SelectedValue.ToString() + ".xml");
#endif
					switch(dbType)
					{
						case DBTypes.MYSQL:
							CommonGenerator mysql_DACGen = new CommonGenerator(cboTables.SelectedValue.ToString(), doc);
							mysql_DACGen.Generate(templatesPath + "mysql_2_sql.xsl");
							doc.LoadXml(mysql_DACGen.CommonCode);
							break;
						case DBTypes.MSACCESS:
							CommonGenerator msaccess_DACGen = new CommonGenerator(cboTables.SelectedValue.ToString(), doc);
							msaccess_DACGen.Generate(templatesPath + "msaccess_2_sql.xsl");
							doc.LoadXml(msaccess_DACGen.CommonCode);
							break;
						default:
							break;
					}
					StringReader rdr = new StringReader(doc.OuterXml);
					dsTable = new DataSet();
					dsTable.ReadXml(rdr);
					rdr.Close();

				
					//DataView dv = dsTable.Tables[0].DefaultView;
					dsTable.Tables[0].DefaultView.AllowNew = false;
					dsTable.Tables[0].DefaultView.AllowDelete = false;
					dsTable.Tables[1].DefaultView.AllowNew = false;
					dsTable.Tables[1].DefaultView.AllowDelete = false;
					dgColumns.DataSource = null;
					dgColumns.DataSource = dsTable.Tables[0].DefaultView;
				}
			}
			catch(Exception ex)
			{
				while(ex != null)
				{
					MessageBox.Show(ex.Message);
					ex = ex.InnerException;
				}
				//dgColumns.DataSource = dsTable.Tables[0].DefaultView;
			}
		}


		private string dnmlCode()
		{
			StringBuilder strBuilder = new StringBuilder("<dnml>", 2000);
			foreach(string optAssembly in optionalAssemblies)
			{
				strBuilder.Append("<reference assembly=\"" + optAssembly + "\" />");
			}
			strBuilder.Append("<language name=\"" + cboLanguages.Items[cboLanguages.SelectedIndex].ToString() + "\" />");
			strBuilder.Append("<scriptCode><![CDATA[");
			strBuilder.Append(txtCode.Text);
			strBuilder.Append("]]></scriptCode>");
			strBuilder.Append("</dnml>");
			return strBuilder.ToString();
		}


		private void Compile()
		{
			try
			{
				DotNetScriptEngine.ErrorMessages.Clear();
				lvOperationsState.Items.Clear();
				DotNetScriptEngine engine = new DotNetScriptEngine();
				if(!engine.Compile(dnmlCode()))
				{
					//DotNetScriptEngine.DisplayErrorMsg();
					foreach(DotNetScriptEngineError err in DotNetScriptEngine.ErrorMessages)
					{
						AddError(err);
					}
				}
				else
				{
					MessageBox.Show("Compile successful!");
				}
			}
			catch(Exception ex)
			{
				while(ex != null)
				{
					MessageBox.Show(ex.Message);
					ex = ex.InnerException;
				}
			}
		}


		private void CreateAssembly()
		{
			try
			{
				SaveFileDialog saveFileDialog1 = new SaveFileDialog();
				saveFileDialog1.Title = "Save assembly";
				saveFileDialog1.Filter = "Executables|*.exe|Libraries|*.dll";
				saveFileDialog1.ShowDialog();
				CurrentAssembly = saveFileDialog1.FileName;
				if(CurrentAssembly != "")
				{
					DotNetScriptEngine.ErrorMessages.Clear();
					lvOperationsState.Items.Clear();
					DotNetScriptEngine engine = new DotNetScriptEngine();
					if(!engine.Compile(dnmlCode(), CurrentAssembly))
					{
						//DotNetScriptEngine.DisplayErrorMsg();
						foreach(DotNetScriptEngineError err in DotNetScriptEngine.ErrorMessages)
						{
							AddError(err);
						}
					}
					else
					{
						MessageBox.Show("Assembly " + CurrentAssembly + " succesfully generated!");
						SetStatusBarPanelsText(CurrentFile, CurrentAssembly);
					}
				}
			}
			catch(Exception ex)
			{
				while(ex != null)
				{
					MessageBox.Show(ex.Message);
					ex = ex.InnerException;
				}
			}
		}


		private void GenerateSp(string rmdbsTemplate)
		{
			XmlDocument doc = new XmlDocument();
			doc.LoadXml(dsTable.GetXml());
			string tableName = doc.DocumentElement.GetAttribute("name");
			CommonGenerator DACGen = new CommonGenerator(tableName, doc);
			if(PrepareXslParameters(rmdbsTemplate))
			{
				DACGen.Generate(xslParametersDoc);
				txtCode.Text = DACGen.CommonCode;
				CurrentFile = string.Empty;
				if(CommonGenerator.ErrorMessages.Count > 0)
				{
					foreach(string sErr in CommonGenerator.ErrorMessages)
					{
						DotNetScriptEngineError err = new DotNetScriptEngineError(sErr);
						AddError(err);
					}
				}
			}
		}

		private void GenerateCustomFieldsObject(string rmdbsTemplate)
		{
			if(cboTables.SelectedIndex > -1 && mnuStructureTables.Checked && dbType == DBTypes.SQL)
			{
				string tableName = cboTables.SelectedValue.ToString();
				DBHelper dbH = new DBHelper(ConnectionString, dbType);
				XmlDocument doc = dbH.GetTableCustomFieldsStructure(cboTables.SelectedValue.ToString()); //DACGen.GetTableStructure();
				if(doc != null && doc.OuterXml.Trim() != string.Empty)
				{
					CommonGenerator DACGen = new CommonGenerator(tableName, doc);
					if(PrepareXslParameters(rmdbsTemplate))
					{
						DACGen.Generate(xslParametersDoc);
						txtCode.Text = DACGen.CommonCode;
						CurrentFile = string.Empty;
						if(CommonGenerator.ErrorMessages.Count > 0)
						{
							foreach(string sErr in CommonGenerator.ErrorMessages)
							{
								DotNetScriptEngineError err = new DotNetScriptEngineError(sErr);
								AddError(err);
							}
						}
					}
				}
				else
				{
					DotNetScriptEngineError err = new DotNetScriptEngineError("The table " + tableName + " has no custom field defined!");
					AddError(err);
				}
			}
		}


		private void SaveFile(string extension, string language)
		{
			SaveFileDialog saveDlg = new SaveFileDialog();
			saveDlg.Title = "Save " + language + " file";
			saveDlg.Filter = language +" files (*." + extension + ")|*." + extension;
			saveDlg.ShowDialog();
			CurrentFile = saveDlg.FileName;
			if(CurrentFile != "")
			{
				txtCode.SaveFile(CurrentFile, RichTextBoxStreamType.PlainText);
				SetStatusBarPanelsText(CurrentFile, CurrentAssembly);
				bIsDirty = false;
			}
		}

		private void SaveFile(string fileName)
		{
			CurrentFile = fileName;
			if(CurrentFile != null && CurrentFile != "")
			{
				txtCode.SaveFile(CurrentFile, RichTextBoxStreamType.PlainText);
				SetStatusBarPanelsText(CurrentFile, CurrentAssembly);
				bIsDirty = false;
			}
		}

		

		private string dotNetFileExtension(LanguageType languageType)
		{
			string extension = "";
			switch(languageType)
			{
				case LanguageType.CSharp:
					extension = "cs";
					break;
				case LanguageType.JScript:
					extension = "js";
					break;
				case LanguageType.VisualBasic:
					extension = "vb";
					break;
				case LanguageType.VJSharp:
					extension = "jsl";
					break;
				case LanguageType.VisualC:
					extension = "cpp";
					break;
				default:
					extension = "cs";
					break;
			}
			return extension;
		}

		private ObjectTypes Extension2ObjectType(string extension)
		{
			ObjectTypes objType = ObjectTypes.None;
			switch(extension.ToLower())
			{
				case "cs":
					objType = ObjectTypes.CSharp_DAC;
					break;
				case "vb":
					objType = ObjectTypes.VisualBasic_DAC;
					break;
				case "js":
					objType = ObjectTypes.JScript_DAC;
					break;
				case "jsl":
					objType = ObjectTypes.VJSharp_DAC;
					break;
				case "cpp":
					objType = ObjectTypes.VisualC_DAC;
					break;
				case "php":
					objType = ObjectTypes.PHP_DAC;
					break;
				case "cls":
					objType = ObjectTypes.VB60_DAC;
					break;
				case "vbs":
					objType = ObjectTypes.VBScript_DAC;
					break;
				/*
				case "js": //repeated - it is JScript_DAC
					objType = ObjectTypes.COMJScript_DAC;
					break;
				*/
				case "sql":
					objType = ObjectTypes.SQL;
					break;
				case "resx":
					objType = ObjectTypes.UI_RESX;
					break;
				case "htm":
				case "html":
					objType = ObjectTypes.UI_HTML;
					break;
				case "xml":
					objType = ObjectTypes.XML;
					break;
				case "xsd":
					objType = ObjectTypes.XSD;
					break;
				case "txt":
				default:
					objType = ObjectTypes.None;
					break;
			}
			return objType;
		}

		private ObjectTypes Language2ObjectType(LanguageType languageType)
		{
			ObjectTypes objType = ObjectTypes.None;
			switch(languageType)
			{
				case LanguageType.CSharp:
					objType = ObjectTypes.CSharp_DAC;
					break;
				case LanguageType.VisualBasic:
					objType = ObjectTypes.VisualBasic_DAC;
					break;
				case LanguageType.JScript:
					objType = ObjectTypes.JScript_DAC;
					break;
				case LanguageType.VJSharp:
					objType = ObjectTypes.VJSharp_DAC;
					break;
				case LanguageType.VisualC:
					objType = ObjectTypes.VisualC_DAC;
					break;
				default:
					objType = ObjectTypes.None;
					break;
			}
			return objType;
		}

		private void OpenFile(string extension, string language, ObjectTypes objType)
		{
			if(CancelEditing())
			{
				OpenFileDialog openDlg = new OpenFileDialog();
				openDlg.Title = "Open " + language + " file";
				openDlg.Filter = language +" files (*." + extension + ")|*." + extension;
				openDlg.ShowDialog();
				if(openDlg.FileName != "")
				{
					txtCode.LoadFile(openDlg.FileName, RichTextBoxStreamType.PlainText);
					SetStatusBarPanelsText(CurrentFile, CurrentAssembly);
					BuildRegExpr(objType.ToString().Replace("_DAC", ""));
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = objType;
					bIsDirty = false;
					CurrentFile = openDlg.FileName;
				}
			}
		}

		private void OpenFile(string fileName)
		{
			if(fileName != null && fileName != "")
			{
				ObjectTypes objType;
				string extension = fileName.Substring(fileName.LastIndexOf(".") + 1);
				objType = Extension2ObjectType(extension);
				txtCode.LoadFile(fileName, RichTextBoxStreamType.PlainText);
				SetStatusBarPanelsText(CurrentFile, CurrentAssembly);
				BuildRegExpr(objType.ToString().Replace("_DAC", ""));
				ApplyColorCoding(txtCode.Text, reCoding);
				ObjectType = objType;
				bIsDirty = false;
				CurrentFile = fileName;
			}
		}


		private void SetStatusBarPanelsText(string currentFile, string assemblyFile)
		{
			sbPanelCurrentFile.Text = currentFile;
			sbPanelAssembly.Text = assemblyFile;
		}
	

		private void FillComboTables()
		{
			try
			{
				DBHelper dbH = new DBHelper(ConnectionString, dbType);
				if(mnuStructureTables.Checked)
					if(mnuStructureViews.Checked)
						dtTables = dbH.GetTables();
					else
						dtTables = dbH.GetBaseTables();
				else
					if(mnuStructureViews.Checked)
						dtTables = dbH.GetViews();
					else
						dtTables = null;
				cboTables.DataSource = dtTables;
				cboTables.DisplayMember = "Name";
				cboTables.ValueMember = "Name";
			}
			catch(Exception ex)
			{
				while(ex != null)
				{
					MessageBox.Show(ex.Message);
					ex = ex.InnerException;
				}
			}
		}

		private void FillComboRoutines()
		{
			try
			{
				DBHelper dbH = new DBHelper(ConnectionString, dbType);
				if(mnuStructureStoredPrcedures.Checked)
					if(mnuStructureFunctions.Checked)
						dtTables = dbH.GetRoutines();
					else
						dtTables = dbH.GetStoredProcedures();
				else
					if(mnuStructureFunctions.Checked)
						dtTables = dbH.GetFunctions();
				else
					dtTables = null;
				cboTables.DataSource = dtTables;
				cboTables.DisplayMember = "Name";
				cboTables.ValueMember = "Name";
			}
			catch(Exception ex)
			{
				while(ex != null)
				{
					MessageBox.Show(ex.Message);
					ex = ex.InnerException;
				}
			}
		}

		private void ParseSQL(string sqlText)
		{
			string goPattern = @"(?i)\sGO\s";
			Regex re = new Regex(goPattern);
			MatchCollection coll = re.Matches(sqlText);
			string sBatch;
			SqlConnection cnn = null;
			int iFirst = 0;
			lvOperationsState.Items.Clear();
			bool bCompleted = true;
			if(coll.Count > 0)
			{
				foreach(Match m in coll)
				{
					try
					{
						sBatch = sqlText.Substring(iFirst, m.Index - iFirst);
						iFirst = m.Index + m.Length;
						cnn = new SqlConnection(ConnectionString);
						string cmdText = "SET PARSEONLY ON\r\n" + sBatch;
						SqlCommand cmd = new SqlCommand(cmdText, cnn);
						cnn.Open();
						cmd.ExecuteNonQuery();
					}
					catch(SqlException ex)
					{
						bCompleted = false;
						foreach(SqlError sqlErr in ex.Errors)
						{
							DotNetScriptEngineError err = new DotNetScriptEngineError(sqlErr.Message, sqlErr.LineNumber, 0, sqlErr.Procedure + " - " + sqlErr.Source);
							AddError(err);
						}
					}
					catch(Exception ex)
					{
						bCompleted = false;
						while(ex != null)
						{
							DotNetScriptEngineError err = new DotNetScriptEngineError(ex.Message, -1, 0, ex.Source + " - " + ex.StackTrace);
							AddError(err);
							ex = ex.InnerException;
						}
					}
					finally
					{
						cnn.Close();
					}
				}
			}
			else
			{
				try
				{
					cnn = new SqlConnection(ConnectionString);
					string cmdText = "SET PARSEONLY ON\r\n" + sqlText;
					SqlCommand cmd = new SqlCommand(cmdText, cnn);
					cnn.Open();
					cmd.ExecuteNonQuery();
				}
				catch(SqlException ex)
				{
					bCompleted = false;
					foreach(SqlError sqlErr in ex.Errors)
					{
						DotNetScriptEngineError err = new DotNetScriptEngineError(sqlErr.Message, sqlErr.LineNumber, 0, sqlErr.Procedure + " - " + sqlErr.Source);
						AddError(err);
					}
				}
				catch(Exception ex)
				{
					bCompleted = false;
					while(ex != null)
					{
						DotNetScriptEngineError err = new DotNetScriptEngineError(ex.Message, -1, 0, ex.Source + " - " + ex.StackTrace);
						AddError(err);
						ex = ex.InnerException;
					}
				}
				finally
				{
					cnn.Close();
				}
			}
			if(bCompleted)
			{
				DotNetScriptEngineError result = new DotNetScriptEngineError("The command(s) completed succesfully.", -1, 0, "");
				AddError(result);
			}
		}


		private void ExecuteSQL(string sqlText)
		{
			string goPattern = @"(?i)\sGO\s";
			Regex re = new Regex(goPattern);
			MatchCollection coll = re.Matches(sqlText);
			string sBatch;
			SqlConnection cnn = null;
			int iFirst = 0;
			lvOperationsState.Items.Clear();
			bool bCompleted = true;
			if(coll.Count > 0)
			{
				foreach(Match m in coll)
				{
					try
					{
						sBatch = sqlText.Substring(iFirst, m.Index - iFirst);
						iFirst = m.Index + m.Length;
						cnn = new SqlConnection(ConnectionString);
						string cmdText = sBatch;
						SqlCommand cmd = new SqlCommand(cmdText, cnn);
						cnn.Open();
						cmd.ExecuteNonQuery();
					}
					catch(SqlException ex)
					{
						bCompleted = false;
						foreach(SqlError sqlErr in ex.Errors)
						{
							DotNetScriptEngineError err = new DotNetScriptEngineError(sqlErr.Message, sqlErr.LineNumber, 0, sqlErr.Procedure + " - " + sqlErr.Source);
							AddError(err);
						}
					}
					catch(Exception ex)
					{
						bCompleted = false;
						while(ex != null)
						{
							DotNetScriptEngineError err = new DotNetScriptEngineError(ex.Message, -1, 0, ex.Source + " - " + ex.StackTrace);
							AddError(err);
							ex = ex.InnerException;
						}
					}
					finally
					{
						cnn.Close();
					}
				}
			}
			else
			{
				try
				{
					cnn = new SqlConnection(ConnectionString);
					string cmdText = sqlText;
					SqlCommand cmd = new SqlCommand(cmdText, cnn);
					cnn.Open();
					cmd.ExecuteNonQuery();
				}
				catch(SqlException ex)
				{
					bCompleted = false;
					foreach(SqlError sqlErr in ex.Errors)
					{
						DotNetScriptEngineError err = new DotNetScriptEngineError(sqlErr.Message, sqlErr.LineNumber, 0, sqlErr.Procedure + " - " + sqlErr.Source);
						AddError(err);
					}
				}
				catch(Exception ex)
				{
					bCompleted = false;
					while(ex != null)
					{
						DotNetScriptEngineError err = new DotNetScriptEngineError(ex.Message, -1, 0, ex.Source + " - " + ex.StackTrace);
						AddError(err);
						ex = ex.InnerException;
					}
				}
				finally
				{
					cnn.Close();
				}
			}
			if(bCompleted)
			{
				DotNetScriptEngineError result = new DotNetScriptEngineError("The command(s) completed succesfully.", -1, 0, "");
				AddError(result);
			}
		}

		private void SetOperationsListToolTip()
		{
			if(lvOperationsState.SelectedIndices.Count > 1)
			{
				toolTip1.SetToolTip(lvOperationsState, lvOperationsState.Items[lvOperationsState.SelectedIndices[0]].SubItems[0].Text);
			}
		}

		private void SetOperationListErrors()
		{
			lvOperationsState.Columns.Clear();
			ColumnHeader col = new ColumnHeader();
			col.Text = "Error";
			col.Width = 250;
			lvOperationsState.Columns.Add(col);
			col = new ColumnHeader();
			col.Text = "Line";
			col.Width = 20;
			lvOperationsState.Columns.Add(col);
			col = new ColumnHeader();
			col.Text = "Column";
			col.Width = 50;
			lvOperationsState.Columns.Add(col);
			col = new ColumnHeader();
			col.Text = "File";
			col.Width = 100;
			lvOperationsState.Columns.Add(col);
		}

		private void AddError(DotNetScriptEngineError err)
		{
			string[] subItems = new string[]{err.error, err.line.ToString(), err.column.ToString(), err.file};
			ListViewItem item = new ListViewItem(subItems);
			lvOperationsState.Items.Add(item);
		}

		private void AddError(Exception ex)
		{
			DotNetScriptEngineError err = new DotNetScriptEngineError(ex.Message, -1, 0, ex.Source + " - " + ex.StackTrace);
			AddError(err);
		}

		private void AddError(string errorMessage)
		{
			DotNetScriptEngineError err = new DotNetScriptEngineError(errorMessage, -1, 0, CurrentFile);
			AddError(err);
		}

		private void ApplyColorCoding(string sText, Regex re)
		{
			int currentIndex = txtCode.SelectionStart;
			try
			{
				auxRTF.Text = sText;
				auxRTF.Font = txtCode.Font;//new Font("Verdana", 10);
				auxRTF.SelectionStart = 0;
				auxRTF.SelectionLength = sText.Length;
				auxRTF.SelectionColor = Color.Empty;
		
				MatchCollection coll = re.Matches(auxRTF.Text);
				foreach(Match m in coll)
				{
						auxRTF.SelectionStart = m.Index;
						auxRTF.SelectionLength = m.Value.Trim().Length;
						auxRTF.SelectionColor = color;
				}
				if(auxRTF.Rtf != null)
				{
					txtCode.Rtf = auxRTF.Rtf;
				}
				txtCode.SelectionStart = currentIndex;
			}
			catch(Exception ex)
			{
				throw ex;
			}			
		}

		private void BuildRegExpr(string language)
		{
			try
			{
				XmlDocument keysDoc = new XmlDocument();
				keysDoc.Load(templatesPath + "keys_" + language + ".xml");
				XmlNode node = keysDoc.SelectSingleNode("//section[@name='keywords']");
				string sColor = ((XmlElement)node).GetAttribute("color");
				color = Color.FromName(sColor);
				XmlNodeList coll = keysDoc.SelectNodes("//key");
				string sKeywords = "";
				foreach(XmlNode n in coll)
				{
					if(n.InnerText.Trim() != string.Empty)
					{
						if(sKeywords == string.Empty)
							sKeywords = n.InnerText;
						else
							sKeywords += "|" + n.InnerText;
					}
				}
				string sCaseSensitive = ((XmlElement)node).GetAttribute("case-sensitive");
				string sExpression;
				if(sCaseSensitive == "yes")
					sExpression = @"\b(" + sKeywords + @")\b";
				else
					sExpression = @"(?i)\b(" + sKeywords + @")\b";
				reCoding = new Regex(sExpression);
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}

		private bool PrepareXslParameters(string xslFileName)
		{
			xslParametersDoc = new XmlDocument();
			xslParametersDoc.Load(xslFileName);
			XmlNamespaceManager nsmgr = new XmlNamespaceManager(xslParametersDoc.NameTable);
			nsmgr.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform");
			XmlNodeList parameters = xslParametersDoc.SelectNodes("/xsl:stylesheet/xsl:param", nsmgr);
			DataTable dtParameters = new DataTable();
			dtParameters.Columns.Add(new DataColumn("name", typeof(string)));
			dtParameters.Columns.Add(new DataColumn("value", typeof(string)));
			dtParameters.Columns.Add(new DataColumn("select", typeof(bool)));
			DataRow dr;
			XmlElement elem;
			foreach(XmlNode param in parameters)
			{
				elem = (XmlElement)param;
				if(elem != null)
				{
					dr = dtParameters.NewRow();
					dr["name"] = elem.GetAttribute("name");
					dr["value"] = elem.GetAttribute("select") == string.Empty ? elem.InnerText : elem.GetAttribute("select");
					dr["select"] = elem.GetAttribute("select") != string.Empty;
					dtParameters.Rows.Add(dr);
				}
			}

			if(dtParameters.Rows.Count == 0) return true;
			frmParameters frm = new frmParameters(dtParameters);
			frm.SelectParameters += new SelectParametersEventHandler(frm_SelectParameters);
			return (frm.ShowDialog() == DialogResult.OK);
		}

		private RegistryKey OpenDACBuilderKey()
		{
			RegistryKey regKey;
			regKey = Registry.CurrentUser.OpenSubKey(regKeyName, true);
			if(regKey == null)
				regKey = Registry.CurrentUser.CreateSubKey(regKeyName);
			return regKey;
		}

		private bool WriteKey(string name, object value)
		{
			try
			{
				RegistryKey key = OpenDACBuilderKey();
				key.SetValue(name, value);
				key.Close();
				return true;
			}
			catch(Exception ex)
			{
				while(ex != null)
				{
					//DotNetScriptEngineError err = new DotNetScriptEngineError(ex.Message, -1, 0, ex.Source + " - " + ex.StackTrace);
					AddError(ex);
					ex = ex.InnerException;
				}
				return false;
			}
		}

		private object ReadKey(string name, object defaultValue)
		{
			try
			{
				RegistryKey key = OpenDACBuilderKey();
				object o = key.GetValue(name, defaultValue);
				key.Close();
				return o;
			}
			catch(Exception ex)
			{
				while(ex != null)
				{
					//DotNetScriptEngineError err = new DotNetScriptEngineError(ex.Message, -1, 0, ex.Source + " - " + ex.StackTrace);
					AddError(ex);
					ex = ex.InnerException;
				}
				return null;
			}
		}

		private bool CancelEditing()
		{
			bool bContinue = true;
			if(bIsDirty)
			{
				DialogResult dr = MessageBox.Show("Current file is not saved! Continue anyway?", "File not saved", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
				if(dr == DialogResult.No)
				{
					bContinue = false;
				}
			}
			return bContinue;
		}

		private void LoadStandardAssemblies()
		{
			MenuItem item;
			StreamReader rdr = new StreamReader(templatesPath + "standardAssemblies.txt");
			string sLine;
			sLine = rdr.ReadLine();
			int iLine = 0;
			Point p = new Point(0, 0);
			Rectangle r = Screen.GetWorkingArea(p);
			Font f = new Font("Microsoft Sans Serif", 18);
			while(sLine != null && sLine.Trim() != string.Empty)
			{
				if(!sLine.StartsWith("CrystalDecisions"))
				{
					sLine = sLine.Substring(0, sLine.IndexOf(",")) + ".dll";
					item = new MenuItem(sLine);
					item.Click += new EventHandler(item_Click);
					standardAssembliesMenu.MenuItems.Add(item);
					iLine++;
					if(iLine == (int)(r.Height / f.Size))
					{
						item.Break = true;
						iLine = 0;
					}
				}
				sLine = rdr.ReadLine();
			}
			rdr.Close();
		}

		private void DeleteOptionalAssembly(string assembly)
		{
			int i = 0;
			bool bFound = false;
			foreach(string s in optionalAssemblies)
			{		
				if(s.Equals(assembly))
				{
					bFound = true;
					break;
				}
				i++;
			}
			if(bFound)
				optionalAssemblies.RemoveAt(i);
		}

		private int FindText()
		{
			int returnValue = -1;

			string searchText = searchParams.FindWhat;
			int searchStart = searchParams.SearchStart;
			int searchEnd = searchParams.SearchEnd;
			RichTextBoxFinds rtbFinds = searchParams.FindOptions;
			if(searchText.Length > 0 && searchStart >= 0)
			{
				int indexToText = txtCode.Find(searchText, searchStart, searchEnd, rtbFinds);
				if(indexToText >= 0)
				{
					returnValue = indexToText;
				}
			}
			return returnValue;
		}

		private void CreateConnectionStringsMenu()
		{
			DirectoryInfo di = new DirectoryInfo(templatesPath + "connection_strings");
			if(di.Exists)
			{
				FileInfo[] xslFileNames = di.GetFiles("*.xsl");
				MenuItem[] mnuToolsConnectionStringsItems = new MenuItem[xslFileNames.Length];
				for(int i = 0; i < xslFileNames.Length; i++)
				{
					string xslFileName = xslFileNames[i].Name.Replace(".xsl", ""); //.Substring(xslFileNames[i].LastIndexOf("\\") + 1, xslFileNames[i].LastIndexOf(".xsl"));
					mnuToolsConnectionStringsItems[i] = new MenuItem(xslFileName);
					mnuToolsConnectionStringsItems[i].Click += new EventHandler(mnuToolsConnectionStringsItems_Click);
				}
				mnuToolsConnectionStrings.MenuItems.AddRange(mnuToolsConnectionStringsItems);
			}
		}


		private void CustomFieldsTableScript(string tableName)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\" + tableName + "_tbl.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void CustomFieldsSPScript(string tableName)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\" + tableName + "_sp.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		#endregion

		#region events

		private void mnuStructureGetTable_Click(object sender, System.EventArgs e)
		{
			GetStructure();
		}


		private void mnuSpGenerate_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					if(dsTable != null && dsTable.Tables.Count > 0)
					{
						if(dsTable.Tables[0].Rows[0]["base"].ToString().Equals("Historic"))
						{
							GenerateSp(templatesPath + "sp_sql_historic.xsl");
						}
						else
						{
							GenerateSp(templatesPath + "sp_sql.xsl");
						}
						BuildRegExpr("SQL");
						ApplyColorCoding(txtCode.Text, reCoding);
						ObjectType = ObjectTypes.SQL;
					}
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}


		private void mnuDACCreateAssembly_Click(object sender, System.EventArgs e)
		{
			CreateAssembly();
		}


		private void mnuDACCompile_Click(object sender, System.EventArgs e)
		{
			Compile();
		}


		private void txtCode_TextChanged(object sender, System.EventArgs e)
		{
			RichTextBox txtCode = (RichTextBox)sender;
			bIsDirty = true;
			int currentIndex = txtCode.SelectionStart;
			/*
			try
			{
				//Regex r = new Regex(@"([ \t\r\n]+|\A)(public|void|class)([ \t\r\n]+|\Z)");
				int x = txtCode.Find(" ", currentIndex, RichTextBoxFinds.Reverse);
				string s;
				if(currentIndex - x > 0) 
					s = txtCode.Text.Substring(x + 1, currentIndex - x);
				else
					s = txtCode.Text.Substring(x + 1, 0);
				Match m = reCoding.Match(s);
				if(m.Success)
				{
					txtCode.SelectionStart = x + 1;
					txtCode.SelectionLength = currentIndex - x;
					txtCode.SelectionColor = Color.Blue;
				}
			}
			catch
			{
			}
			finally
			{
				txtCode.SelectionStart = currentIndex;
			}
			*/
			/*
			try
			{
				int iLine = txtCode.GetLineFromCharIndex(currentIndex);

				if(txtCode.Lines.Length == 0) return;
				string sLineText = "";

				sLineText = txtCode.Lines[iLine];

				int nChars = 0;
				for(int i = 0; i < iLine; i++)
				{
					nChars += txtCode.Lines[i].Length + 1;
				}
		
				//auxRTF.Rtf = txtCode.Rtf;
				txtCode.SelectionStart = nChars;
				txtCode.SelectionLength = sLineText.Length + 1;
				txtCode.SelectionColor = Color.Black;
				MatchCollection coll = reCoding.Matches(sLineText);
				foreach(Match m in coll)
				{
					txtCode.SelectionStart = nChars + m.Index;
					txtCode.SelectionLength = m.Value.Trim().Length;
					txtCode.SelectionColor = Color.Blue;
				}
				//txtCode.Rtf = auxRTF.Rtf;
				txtCode.Select(currentIndex, 0);
			}
			catch
			{
			}
			*/
		}


		private void BForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			if(bIsDirty)
			{
				e.Cancel = true;
				DialogResult result = MessageBox.Show("Current file is not saved! Would you like to save it now?", "Save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
				switch(result)
				{
					case DialogResult.Yes:
						mnuFileSave_Click(sender, e);
						e.Cancel = bIsDirty;
						break;
					case DialogResult.No:
						e.Cancel = false;
						break;
					default:
						e.Cancel = true;
						break;
				}
			}
		}


		private void btnOpAssembliesAdd_Click(object sender, System.EventArgs e)
		{
			OpenFileDialog openDlg = new OpenFileDialog();
			openDlg.Title = "Choose assembly file";
			openDlg.Filter = "Assemblies (*.dll)|*.dll";
			openDlg.ShowDialog();
			if(openDlg.FileName != "")
			{
				optionalAssemblies.Add(openDlg.FileName);
				cboOptAssemblies.Items.Add(openDlg.FileName);
				cboOptAssemblies.Text = openDlg.FileName;
			}
		
		}


		private void btnOptAssembliesDelete_Click(object sender, System.EventArgs e)
		{
			int index = cboOptAssemblies.SelectedIndex;
			if(index > -1)
			{
				DialogResult result = MessageBox.Show("Are you sure you want to delete selected optional assembly?", "Delete optional assembly", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
				if(result == DialogResult.Yes)
				{
					//optionalAssemblies.RemoveAt(index);
					DeleteOptionalAssembly(cboOptAssemblies.Items[index].ToString());
					cboOptAssemblies.Items.RemoveAt(index);
					cboOptAssemblies.Text = "";
				}
			}
		}


		private void mnuStructureRefresh_Click(object sender, System.EventArgs e)
		{
			FillComboTables();
		}


		private void mnuSpParse_Click(object sender, System.EventArgs e)
		{
			ParseSQL(txtCode.Text);
		}


		#endregion

		private void cboOptAssemblies_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void cboOptAssemblies_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode == Keys.Enter && cboOptAssemblies.Text.Trim() != string.Empty)
			{
				optionalAssemblies.Add(cboOptAssemblies.Text);
				cboOptAssemblies.Items.Add(cboOptAssemblies.Text);
			}
		}

		private void lvOperationsState_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			SetOperationsListToolTip();
		}

		private void lvOperationsState_DoubleClick(object sender, System.EventArgs e)
		{
			//txtCode.Lines[0].
			if(lvOperationsState.SelectedIndices.Count > 0)
			{
				int line = int.Parse(lvOperationsState.Items[lvOperationsState.SelectedIndices[0]].SubItems[1].Text);
				int column = int.Parse(lvOperationsState.Items[lvOperationsState.SelectedIndices[0]].SubItems[2].Text);
				int nChars = 0;
				for(int i = 0; i < line - 1; i++)
				{
					nChars += txtCode.Lines[i].Length + 1;
				}
				txtCode.SelectionStart = nChars + column;
				if(txtCode.Lines.Length > 0)
				{
					txtCode.SelectionLength = 1;//txtCode.Lines[line].Length; 
				}
				txtCode.Focus();
			}
		}

		private void txtCode_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			/*
			if(e.KeyCode == Keys.V && e.Control)
				ApplyColorCoding(txtCode.Text, reCoding);
			*/
		}

		private void timColorCoding_Tick(object sender, EventArgs e)
		{
			ApplyColorCoding(txtCode.Text, reCoding);
		}

		private void cboLanguages_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		}

		private void txtCode_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
		
		}

		private void mnuSpOracleProcedures_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "sp_ora.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuDACGenerateResources_Click(object sender, System.EventArgs e)
		{
			frmResources frm = new frmResources();
			frm.Show();
		}

		private void mnuUIGenerateWebForm_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "WebForm.xsl");
					BuildRegExpr(ObjectTypes.UI_ASPX.ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.UI_ASPX;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuItem_txtCodeMenu_Cut_Click(object sender, System.EventArgs e)
		{
			txtCode.Cut();
		}

		private void mnuItem_txtCodeMenu_Copy_Click(object sender, System.EventArgs e)
		{
			txtCode.Copy();
		}

		private void mnuItem_txtCodeMenu_Paste_Click(object sender, System.EventArgs e)
		{
			txtCode.Paste();
		}

		private void mnuItem_txtCodeMenu_SelectAll_Click(object sender, System.EventArgs e)
		{
			txtCode.SelectAll();
		}

		private void txtCodeMenu_Popup(object sender, System.EventArgs e)
		{
			mnuItem_txtCodeMenu_Cut.Enabled 
				= mnuItem_txtCodeMenu_Copy.Enabled 
				= txtCode.SelectedText != string.Empty;
			IDataObject iData = Clipboard.GetDataObject();
			mnuItem_txtCodeMenu_Paste.Enabled = iData.GetDataPresent(DataFormats.Text);
		}

		private void frm_SelectParameters(object sender, SelectParametersEventArgs e)
		{
			XmlNamespaceManager nsmgr = new XmlNamespaceManager(xslParametersDoc.NameTable);
			nsmgr.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform");
			XmlNode node;
			XmlElement elem;
			bool bIsSelect;
			foreach(DataRow dr in e.Parameters.Rows)
			{
				node = xslParametersDoc.SelectSingleNode("/xsl:stylesheet/xsl:param[@name='" + dr["name"].ToString() + "']", nsmgr);
				if(node != null)
				{
					elem = (XmlElement)node;
					bIsSelect = (bool)dr["select"];
					if(bIsSelect)
						elem.SetAttribute("select", dr["value"].ToString());
					else
						node.InnerText = dr["value"].ToString();
				}
			}
		}

		private void mnuSpExecute_Click(object sender, System.EventArgs e)
		{
			if(DialogResult.Yes == MessageBox.Show("Are you sure you want to execute SQL code on current server?", "Execute SQL", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
			{
				ExecuteSQL(txtCode.Text);
			}
		}

		private void mnuSpOtherSqlTemplates_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					if(dsTable != null && dsTable.Tables.Count > 0)
					{
						OpenFileDialog openDlg = new OpenFileDialog();
						openDlg.Title = "SQL procedure templates files";
						openDlg.Filter = "SQL procedure templates files (*.xsl, *.xslt)|*.xsl;*.xslt";
						openDlg.ShowDialog();
						if(openDlg.FileName != "")
						{
							GenerateSp(openDlg.FileName);
							BuildRegExpr("SQL");
							ApplyColorCoding(txtCode.Text, reCoding);
							ObjectType = ObjectTypes.SQL;
						}
					}
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuStructureCreateTableFromString_Click(object sender, System.EventArgs e)
		{
/*
	1 AS TAG,
	NULL AS PARENT,
	@TABLE_NAME AS [table!1!name],
	UPPER(SUBSTRING(@TABLE_NAME, 1, 1)) + LOWER(SUBSTRING(@TABLE_NAME, 2, LEN(@TABLE_NAME) - 1)) AS [table!1!friendly_name],
	@BASE AS [table!1!base],
	'' AS [table!1!namespace],
	'' AS [table!1!abbreviation],
	NULL AS [column!2!column_name],
	NULL AS [column!2!column_friendly_name],
	NULL AS [column!2!ordinal_position],
	NULL AS [column!2!column_default],
	NULL AS [column!2!is_nullable],
	NULL AS [column!2!data_type],
	NULL AS [column!2!character_maximum_length],
	NULL AS [column!2!character_octet_length],
	NULL AS [column!2!numeric_precision],
	NULL AS [column!2!numeric_precision_radix],
	NULL AS [column!2!numeric_scale],
	NULL AS [column!2!datetime_precision],
	NULL AS [column!2!identity],
	NULL AS [column!2!constraint_type],
	NULL AS [column!2!referenced_table],
	NULL AS [column!2!column_description]
*/
			CommonGenerator DACGen = new CommonGenerator(cboTables.SelectedValue.ToString());
			XmlDocument doc = DACGen.GetTableStructure();
			StringReader rdr = new StringReader(doc.OuterXml);
			dsTable = new DataSet();
			dsTable.ReadXml(rdr);
			rdr.Close();

			dsTable.Tables[1].Rows.Clear();
			dsTable.Tables[0].Rows.Clear();

			dsTable.Tables[0].DefaultView.AllowNew = false;
			dsTable.Tables[0].DefaultView.AllowDelete = false;
			dsTable.Tables[1].DefaultView.AllowNew = false;
			dsTable.Tables[1].DefaultView.AllowDelete = false;

			DataRow dr = dsTable.Tables[0].NewRow();
			dr["name"] = "Table1";
			dr["friendly_name"] = "Table1";
			dr["base"] = "Table1";
			dr["namespace"] = "Table1";
			dr["abbreviation"] = "Tbl1";
			dsTable.Tables[0].Rows.Add(dr);
			string[] sFieldInfo;
			string sField;

			if(txtCode.Text.Trim() != string.Empty)
			{
				string[] sFields = txtCode.Text.Split('|');
				for(int i = 0; i < sFields.Length; i++)
				{
					sField = sFields[i];
					dr = dsTable.Tables[1].NewRow();
					sFieldInfo = sField.Split('#');
					dr["column_name"] = sFieldInfo[0];
					dr["column_friendly_name"] = sFieldInfo[0];
					dr["ordinal_position"] = i + 1;
					//dr["column_default"] = string.Empty;
					dr["is_nullable"] = "YES";
					dr["data_type"] = sFieldInfo[1];
					dr["character_maximum_length"] = sFieldInfo.Length > 2 ? sFieldInfo[2] : string.Empty;
					//dr["character_octet_length"] = DBNull.Value;
					//dr["numeric_precision"] = DBNull.Value;
					//dr["numeric_precision_radix"] = DBNull.Value;
					//dr["numeric_scale"] = DBNull.Value;
					//dr["datetime_precision"] = DBNull.Value;
					//dr["identity"] = DBNull.Value;
					//dr["constraint_type"] = DBNull.Value;
					//dr["referenced_table"] = DBNull.Value;
					//dr["column_description"] = DBNull.Value;
					dsTable.Tables[1].Rows.Add(dr);
				}
			}
			dgColumns.DataSource = dsTable.Tables[0].DefaultView;
		}

		private void mnuDACSimpleDAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "simpleDAC_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_SQL.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.CSharp_DAC;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuSpSelectByPK_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "sp_sql_select_by_pk.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuToolsClearErrors_Click(object sender, System.EventArgs e)
		{
			lvOperationsState.Items.Clear();
		}

		private void mnuToolsApplyColorCoding_Click(object sender, System.EventArgs e)
		{
			ApplyColorCoding(txtCode.Text, reCoding);
		}

		private void mnuToolsFont_Click(object sender, System.EventArgs e)
		{
			FontDialog fd = new FontDialog();
			fd.ShowColor = false;
			fd.Font = txtCode.Font;
			if(DialogResult.OK == fd.ShowDialog())
			{
				txtCode.Font = fd.Font;
				ApplyColorCoding(txtCode.Text, reCoding);
				WriteKey(keyFontFamily, fd.Font.Name);
				WriteKey(keyFontSize, fd.Font.Size);
				WriteKey(keyFontStyle, (int)fd.Font.Style);
			}
		}

		private void mnuStructureTables_Click(object sender, System.EventArgs e)
		{
			mnuStructureTables.Checked = !mnuStructureTables.Checked;
			FillComboTables();		
		}

		private void mnuStructureViews_Click(object sender, System.EventArgs e)
		{
			mnuStructureViews.Checked = !mnuStructureViews.Checked;
			FillComboTables();		
		}

		private void btnOpStandardAssemblies_Click(object sender, System.EventArgs e)
		{
			standardAssembliesMenu.Show(btnOpStandardAssemblies, new Point(0, btnOpStandardAssemblies.Height));
		}

		private void item_Click(object sender, EventArgs e)
		{
			MenuItem m = (MenuItem)sender;
			m.Checked = !m.Checked;
			DeleteOptionalAssembly(m.Text);
			if(m.Checked)
			{
				optionalAssemblies.Add(m.Text);
			}
		}

		private void mnuToolsNewConnection_Click(object sender, System.EventArgs e)
		{
			XmlElement Elem;
			frmNewConnection form = new frmNewConnection(dbType, ConnectionString);
			form.GetConnString += new GetConnStringEventHandler(form_GetConnString);
			if(form.ShowDialog() == DialogResult.OK)
			{
				XmlDocument ConfigDoc = new XmlDocument();
				try
				{
					ConfigDoc.Load(Application.ExecutablePath+".config");
					Elem = (XmlElement)ConfigDoc.SelectSingleNode(@"/configuration/appSettings/add[@key='DBType']");
					Elem.SetAttribute("value", dbType.ToString());
					Elem = (XmlElement)ConfigDoc.SelectSingleNode(@"/configuration/appSettings/add[@key='ConnectionString']");
					Elem.SetAttribute("value", ConnectionString);
					ConfigDoc.Save(Application.ExecutablePath+".config");

					FillComboTables();
					SetControls();
				}
				catch(Exception ex)
				{
					AddError(ex);
				}
			}
		}



		private void form_GetConnString(object sender, GetConnStringEventArgs e)
		{
			dbType = e.DBType;
			ConnectionString = e.ConnectionString;
		}

		private void mnuUIGenerateWebUserControl_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "WebUserControl.xsl");
					BuildRegExpr(ObjectTypes.UI_ASCX.ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.UI_ASCX;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuUIGenerateHTML_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "html.xsl");
					BuildRegExpr(ObjectTypes.UI_HTML.ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.UI_HTML;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		
		}

		private void mnuUISimpleDAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "simpleDAC_WebUI_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + ".xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.UI_DAC;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuEditFind_Click(object sender, System.EventArgs e)
		{
			frmFind frm = new frmFind();
			frm.SearchText += new SearchTextEventHandler(frm_SearchText);
			frm.Show();
		}

		private void frm_SearchText(object sender, SearchTextEventArgs e)
		{
			lvOperationsState.Items.Clear();
			RichTextBoxFinds rtbFinds = RichTextBoxFinds.None;
			if(e.MatchCase) rtbFinds |= RichTextBoxFinds.MatchCase;
			if(e.MatchWholeWord) rtbFinds |= RichTextBoxFinds.WholeWord;
			if(e.SearchUp) rtbFinds |= RichTextBoxFinds.Reverse;
			 
			searchParams.FindWhat = e.FindWhat;
			searchParams.FindOptions = rtbFinds;
			if((rtbFinds & RichTextBoxFinds.Reverse) == RichTextBoxFinds.Reverse)
			{
				searchParams.SearchStart = 0;
				searchParams.SearchEnd = bAtStart ? -1 : txtCode.SelectionStart;
			}
			else
			{
				searchParams.SearchStart = searchParams.SearchStart == -1 ? txtCode.SelectionStart : searchParams.SearchStart;
				searchParams.SearchEnd = -1;
			}
			int index = FindText();
			if(index != -1)
			{
				txtCode.SelectionStart = index;
				txtCode.SelectionLength = e.FindWhat.Length;
				if((rtbFinds & RichTextBoxFinds.Reverse) == RichTextBoxFinds.Reverse)
				{
					searchParams.SearchEnd = index;
					bAtStart = false;
				}
				else
				{
					searchParams.SearchStart = index + e.FindWhat.Length;
				}
			}
			else
			{
				if((searchParams.FindOptions & RichTextBoxFinds.Reverse) == RichTextBoxFinds.Reverse)
				{
					AddError("Passed the start of the document.");
					bAtStart = true;
				}
				else
				{
					AddError("Passed the end of the document.");
					searchParams.SearchStart = 0;
				}
			}
		}

		private void mnuEditFindNext_Click(object sender, System.EventArgs e)
		{
			lvOperationsState.Items.Clear();
			searchParams.FindOptions = RichTextBoxFinds.None;
			searchParams.SearchEnd = -1;
			if(searchParams.FindWhat.Trim() != string.Empty)
			{
				int index = FindText();
				if(index != -1)
				{
					txtCode.SelectionStart = index;
					txtCode.SelectionLength = searchParams.FindWhat.Length;
					//txtCode.Focus();
					searchParams.SearchStart = index + searchParams.FindWhat.Length;
				}
				else
				{
					lvOperationsState.Items.Clear();
					AddError("Passed the end of the document.");
					searchParams.SearchStart = 0;
				}
			}
		}

		private void mnuEditCopy_Click(object sender, System.EventArgs e)
		{
			txtCode.Copy();
		}

		private void mnuEdit_Popup(object sender, System.EventArgs e)
		{
			mnuEditCopy.Enabled 
				= mnuEditCut.Enabled 
				= txtCode.SelectedText != string.Empty;
			IDataObject iData = Clipboard.GetDataObject();
			mnuEditPaste.Enabled = iData.GetDataPresent(DataFormats.Text);
			mnuEditUndo.Enabled = txtCode.CanUndo;
			if(txtCode.CanUndo)
			{
				mnuEditUndo.Text = "Undo " + txtCode.UndoActionName;
			}
			mnuEditRedo.Enabled = txtCode.CanRedo;
			if(txtCode.CanRedo)
			{
				mnuEditRedo.Text = "Redo " + txtCode.RedoActionName;
			}
		}

		private void mnuEditUndo_Click(object sender, System.EventArgs e)
		{
			txtCode.Undo();
		}

		private void mnuEditRedo_Click(object sender, System.EventArgs e)
		{
			txtCode.Redo();
		}

		private void mnuEditCut_Click(object sender, System.EventArgs e)
		{
			txtCode.Cut();
		}

		private void mnuEditPaste_Click(object sender, System.EventArgs e)
		{
			txtCode.Paste();
		}

		private void mnuEditSelectAll_Click(object sender, System.EventArgs e)
		{
			txtCode.SelectAll();
		}

		private void mnuMiscDACPHPDAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "simpleDAC_PHP.xsl");
					BuildRegExpr("CSharp");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.PHP_DAC;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuMiscDACPHPDataAccess_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "DataAccess_PHP.xsl");
					BuildRegExpr("CSharp");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.PHP_DAC;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuSpSQLCreateTable_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "sp_sql_create_table.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuSpSQLGenerateInsertRows_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					XmlDocument doc = new XmlDocument();
					doc.LoadXml(dsTable.GetXml());
					string tableName = doc.DocumentElement.GetAttribute("name");
					DBHelper dbH = new DBHelper(ConnectionString, dbType);
					XmlDocument docData = dbH.GetTableDataXml(tableName);
					XmlNode node = doc.ImportNode(docData.DocumentElement, true);
					doc.DocumentElement.AppendChild(node);
#if DEBUG
					doc.Save(Application.StartupPath + "\\Templates\\" + tableName + "_data.xml");
#endif
					CommonGenerator DACGen = new CommonGenerator(tableName, doc);
					string rmdbsTemplate = templatesPath + "sp_sql_insert_rows.xsl";
					if(PrepareXslParameters(rmdbsTemplate))
					{
						DACGen.Generate(rmdbsTemplate, xslParametersDoc);
						txtCode.Text = DACGen.CommonCode;
						CurrentFile = string.Empty;
						if(CommonGenerator.ErrorMessages.Count > 0)
						{
							foreach(string sErr in CommonGenerator.ErrorMessages)
							{
								DotNetScriptEngineError err = new DotNetScriptEngineError(sErr);
								AddError(err);
							}
						}
						BuildRegExpr("SQL");
						ApplyColorCoding(txtCode.Text, reCoding);
						ObjectType = ObjectTypes.SQL;
					}
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuDACSimpleDACOleDb_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "simpleDAC_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_OleDb.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuDACSimpleDACOdbc_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "simpleDAC_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_Odbc.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuDACGenerateSchema_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "dataset_schema.xsl");
					BuildRegExpr(ObjectTypes.XML.ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.XSD;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuUIGenerateWindowsForm_resx_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "WindowsForm_resx.xsl");
					BuildRegExpr(ObjectTypes.XML.ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.UI_RESX;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuUISimpleDACMethods_win_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "simpleDAC_WinUI_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + ".xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuUICompile_Click(object sender, System.EventArgs e)
		{
			Compile();
		}

		private void mnuUICreateAssembly_Click(object sender, System.EventArgs e)
		{
			CreateAssembly();
		}

		private void mnuSpSearch_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateSp(templatesPath + "sp_sql_search.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuStructureGetRoutine_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(cboTables.SelectedIndex >= 0)
				{
					DBHelper dbH = new DBHelper(ConnectionString, dbType);
					XmlDocument doc = dbH.GetRoutineParameters(cboTables.SelectedValue.ToString()); //DACGen.GetTableStructure();
					StringReader rdr = new StringReader(doc.OuterXml);
					dsTable = new DataSet();
					dsTable.ReadXml(rdr);
					rdr.Close();

				
					//DataView dv = dsTable.Tables[0].DefaultView;
					dsTable.Tables[0].DefaultView.AllowNew = false;
					dsTable.Tables[0].DefaultView.AllowDelete = false;
					dsTable.Tables[1].DefaultView.AllowNew = false;
					dsTable.Tables[1].DefaultView.AllowDelete = false;
					dgColumns.DataSource = dsTable.Tables[0].DefaultView;
				}
			}
			catch(Exception ex)
			{
				while(ex != null)
				{
					MessageBox.Show(ex.Message);
					ex = ex.InnerException;
				}
				//dgColumns.DataSource = dsTable.Tables[0].DefaultView;
			}
	
		}

		private void mnuStructureRefreshRoutinesList_Click(object sender, System.EventArgs e)
		{
			FillComboRoutines();
		}

		private void mnuStructureStoredPrcedures_Click(object sender, System.EventArgs e)
		{
			mnuStructureStoredPrcedures.Checked = !mnuStructureStoredPrcedures.Checked;
			FillComboRoutines();		
		}

		private void mnuStructureFunctions_Click(object sender, System.EventArgs e)
		{
			mnuStructureFunctions.Checked = !mnuStructureFunctions.Checked;
			FillComboRoutines();		
		}

		private void mnuDACExecRoutine_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "execRoutine_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_SQL.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuMiscDACVB60DAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "simpleDAC_VB60_SQL.xsl");
					BuildRegExpr("VisualBasic");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.VB60_DAC;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuMiscDACVBScriptDAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "simpleDAC_VBScript_SQL.xsl");
					BuildRegExpr("VisualBasic");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.VBScript_DAC;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuToolsConnectionStringsItems_Click(object sender, EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					MenuItem item = (MenuItem)sender;
					GenerateDAC(templatesPath + "connection_strings\\" + item.Text + ".xsl");
					/*
					BuildRegExpr("XML");
					ApplyColorCoding(txtCode.Text, reCoding);
					*/
					ObjectType = ObjectTypes.None;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsManagement_Click(object sender, System.EventArgs e)
		{
			if(cboTables.SelectedIndex > -1 && dbType == DBTypes.SQL)
			{
				frmCustomFieldsManagement frm = new frmCustomFieldsManagement(cboTables.SelectedValue.ToString(), this.ConnectionString);
				frm.ShowDialog();
			}
		}

		private void mnuCustomFieldsTable_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsTable");
		}

		private void mnuCustomFieldsTable_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsTable");
		}

		private void mnuCustomFieldsTableColumn_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsTableColumn");
		}

		private void mnuCustomFieldsTableColumn_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsTableColumn");
		}

		private void mnuCustomFieldsType_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsType");		
		}

		private void mnuCustomFieldsType_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsType");		
		}

		private void mnuCustomFieldsSecurity_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsSecurity");				
		}

		private void mnuCustomFieldsSecurity_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsSecurity");
		}

		private void mnuCustomFieldsPropertyList_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsPropertyList");						
		}

		private void mnuCustomFieldsPropertyList_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsPropertyList");
		}

		private void mnuCustomFieldsProperty_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsProperty");
		}

		private void mnuCustomFieldsProperty_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsProperty");		
		}

		private void mnuCustomFieldsValueList_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsValueList");
		}

		private void mnuCustomFieldsValueList_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsValueList");		
		}

		private void mnuCustomFieldsValuesBool_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsValuesBool");		
		}

		private void mnuCustomFieldsValuesBool_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsValuesBool");		
		}

		private void mnuCustomFieldsValuesDateTime_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsValuesDateTime");		
		}

		private void mnuCustomFieldsValuesDateTime_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsValuesDateTime");
		}

		private void mnuCustomFieldsValuesDecimal_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsValuesDecimal");		
		}

		private void mnuCustomFieldsValuesDecimal_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsValuesDecimal");		
		}

		private void mnuCustomFieldsValuesInteger_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsValuesInteger");
		}

		private void mnuCustomFieldsValuesInteger_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsValuesInteger");
		}

		private void mnuCustomFieldsValuesString_tbl_Click(object sender, System.EventArgs e)
		{
			CustomFieldsTableScript("CustomFieldsValuesString");		
		}

		private void mnuCustomFieldsValuesString_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsValuesString");
		}

		private void mnuCustomFieldsGenerateView_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateCustomFieldsObject(templatesPath + "CustomFields\\vwCustomFields.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsGetPropertyListValues_fn_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\GetPropertyListValues_fn.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsGetTableCustomFieldsXML_sp_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\GetTableCustomFieldsXML_sp.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuSpfnGetExtendedProperty_fn_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "fnGetExtendedProperty_fn.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuSpGetTableColumnsXML_sp_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "GetTableColumnsXML_sp.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuSpGetRoutineParametersXML_sp_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "GetRoutineParametersXML_sp.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}				
		}

		private void mnuDACDataAccessContainer_SQL_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "DataAccessContainer_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_SQL.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuDACDataAccessContainer_OleDb_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "DataAccessContainer_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_OleDb.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuDACDataAccessContainer_Odbc_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "DataAccessContainer_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_Odbc.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuDACDataAccessComponent_SQL_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "DataAccessComponent_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_SQL.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuDACDataAccessComponent_OleDb_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "DataAccessComponent_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_OleDb.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuDataAccessComponent_Odbc_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "DataAccessComponent_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_Odbc.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuSpKeyTables_tbl_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "KeyTables_tbl.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}				
		}

		private void mnuSpGET_NEXT_ID_sp_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "GET_NEXT_ID_sp.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}				
		}

		private void mnuCustomFieldsValuesBool_DAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFieldsValuesBool_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + ".xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsValuesDateTime_DAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFieldsValuesDateTime_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + ".xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuCustomFieldsValuesDecimal_DAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFieldsValuesDecimal_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + ".xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuCustomFieldsValuesInteger_DAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFieldsValuesInteger_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + ".xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuCustomFieldsValuesString_DAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFieldsValuesString_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + ".xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuCustomFieldsGenerateClass_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateCustomFieldsObject(templatesPath + "CustomFields\\DACCustomFields_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + ".xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsValues_DELETE_sp_Click(object sender, System.EventArgs e)
		{
			CustomFieldsSPScript("CustomFieldsValues_DELETE");
		}

		private void mnuCustomFieldsGenerateRead_sp_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateCustomFieldsObject(templatesPath + "CustomFields\\CustomFieldsValues_SELECT_sp.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsDBEntitiesAll_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFields_all.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsCustomFieldsTableColumn_SELECT_ByFKTable_sp_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFieldsTableColumn_SELECT_ByFKTable_sp.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsGetPrimaryKeyColumnName_sp_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\GetPrimaryKeyColumnName_sp.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsDBEntitiesCustomFieldsTable_SELECT_ByName_sp_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFieldsTable_SELECT_ByName_sp.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		
		}

		private void mnuToolsClearText_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					txtCode.Text = string.Empty;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuMiscDACJScriptDAC_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "simpleDAC_JScript_SQL.xsl");
					BuildRegExpr("CSharp");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.JScript_DAC;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private void mnuCustomFieldsDACEntitiesUtil_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFields_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + "_util.xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuToolsDACExample_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "DACExample_" + ((LanguageType)cboLanguages.SelectedIndex).ToString() + ".xsl");
					BuildRegExpr(((LanguageType)cboLanguages.SelectedIndex).ToString());
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = Language2ObjectType((LanguageType)cboLanguages.SelectedIndex);
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}		
		}

		private void mnuCustomFieldsCustomFieldsType_insert_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(CancelEditing())
				{
					GenerateDAC(templatesPath + "CustomFields\\CustomFieldsType_insert.xsl");
					BuildRegExpr("SQL");
					ApplyColorCoding(txtCode.Text, reCoding);
					ObjectType = ObjectTypes.SQL;
				}
			}
			catch(Exception ex)
			{
				if(ex.InnerException != null)
					MessageBox.Show(ex.InnerException.Message);
				MessageBox.Show(ex.Message);
			}
		}

		private string FileDialogFilter()
		{
			string filter = "C# files (*.cs)|*.cs" 
				+ "|VB.NET files (*.vb)|*.vb" 
				+ "|SQL files (*.sql)|*.sql" 
				+ "|JScript files (*.js)|*.js" 
				+ "|VBScript files (*.vbs)|*.vbs" 
				+ "|VB6.0 Class files (*.cls)|*.cls" 
				+ "|PHP files (*.php)|*.php" 
				+ "|XML files (*.xml)|*.xml" 
				+ "|ResX files (*.resx)|*.resx" 
				+ "|ASPX files (*.aspx)|*.aspx" 
				+ "|ASCX files (*.ascx)|*.ascx" 
				+ "|HTML files (*.htm, *.html)|*.htm;*.html" 
				+ "|XSD files (*.xsd)|*.xsd" 
				+ "|Text files (*.txt)|*.txt" 
				+ "|All files (*.*)|*.*";
			return filter;
		}

		private void mnuFileOpen_Click(object sender, System.EventArgs e)
		{
			if(CancelEditing())
			{
				OpenFileDialog openDlg = new OpenFileDialog();
				openDlg.Title = "Open file";
				openDlg.Filter = FileDialogFilter();
				DialogResult dr = openDlg.ShowDialog();
				if(dr == DialogResult.OK && openDlg.FileName != "")
				{
					OpenFile(openDlg.FileName);
				}
			}
		}

		private void mnuFileSave_Click(object sender, System.EventArgs e)
		{
			if(CurrentFile != null && CurrentFile != string.Empty)
			{
				SaveFile(CurrentFile);
			}
			else
			{
				mnuFileSaveAs_Click(sender, e);
			}
		}

		private void mnuFileSaveAs_Click(object sender, System.EventArgs e)
		{
			SaveFileDialog saveDlg = new SaveFileDialog();
			saveDlg.Title = "Save file";
			saveDlg.Filter = FileDialogFilter();
			DialogResult dr = saveDlg.ShowDialog();
			if(dr == DialogResult.OK && saveDlg.FileName != "")
			{
				SaveFile(saveDlg.FileName);
			}
		}

		private void mnuFileExit_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void mnuToolsGetXML_Click(object sender, System.EventArgs e)
		{
			if(CancelEditing())
			{
				txtCode.Text = dsTable.GetXml();
				BuildRegExpr("XML");
				ApplyColorCoding(txtCode.Text, reCoding);
				ObjectType = ObjectTypes.XML;
			}
		}

	}

	public enum ObjectTypes
	{
		None = -1
		, CSharp_DAC = 1
		, VisualBasic_DAC = 2
		, JScript_DAC = 3
		, VJSharp_DAC = 4
		, VisualC_DAC = 5
		, PHP_DAC = 100
		, VB60_DAC = 110
		, VBScript_DAC = 120
		, COMJScript_DAC = 130
		, UI_ASPX = 20
		, UI_ASCX = 30
		, UI_HTML = 40
		, UI_DAC = 50
		, UI_RESX = 60
	    , UI_WIN = 70
		, SQL = 200
		, XML = 300
		, XSD = 400
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Telstra Internet
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions