Click here to Skip to main content
Click here to Skip to main content
Articles » Database » Database » Utilities » Downloads
 
Add your own
alternative version

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

, 31 Mar 2006
The DACBuilder application provides auto-generation features from multiple database systems in multiple programming languages.
dacbuilder_demo.zip
DACBuilder_demo
DACBuilder.exe
DACCreator.dll
DataAccess.dll
DataGridCustomColumns.dll
DotNetScripting.dll
FieldTypes.dll
Templates
connection_strings
Access.xsl
AS400(iSeries).xsl
DBF - FoxPro.xsl
DSN.xsl
Excel.xsl
Exchange.xsl
Firebird.xsl
IBM DB2.xsl
Informix.xsl
Ingres.xsl
Interbase.xsl
Lightbase.xsl
Mimer SQL.xsl
MySQL.xsl
Oracle.xsl
Paradox.xsl
Pervasive.xsl
PostgreSQL.xsl
SQL Server 2005.xsl
SQL Server.xsl
Sybase.xsl
Text.xsl
UDL.xsl
Visual FoxPro.xsl
CustomFields
CustomFieldsPropertyList_sp.xsl
CustomFieldsPropertyList_tbl.xsl
CustomFieldsProperty_sp.xsl
CustomFieldsProperty_tbl.xsl
CustomFieldsSecurity_sp.xsl
CustomFieldsSecurity_tbl.xsl
CustomFieldsTableColumn_SELECT_ByFKTable_sp.xsl
CustomFieldsTableColumn_sp.xsl
CustomFieldsTableColumn_tbl.xsl
CustomFieldsTable_SELECT_ByName_sp.xsl
CustomFieldsTable_sp.xsl
CustomFieldsTable_tbl.xsl
CustomFieldsType_insert.xsl
CustomFieldsType_sp.xsl
CustomFieldsType_tbl.xsl
CustomFieldsValueList_sp.xsl
CustomFieldsValueList_tbl.xsl
CustomFieldsValuesBool_CSharp.xsl
CustomFieldsValuesBool_sp.xsl
CustomFieldsValuesBool_tbl.xsl
CustomFieldsValuesBool_VisualBasic.xsl
CustomFieldsValuesDateTime_CSharp.xsl
CustomFieldsValuesDateTime_sp.xsl
CustomFieldsValuesDateTime_tbl.xsl
CustomFieldsValuesDateTime_VisualBasic.xsl
CustomFieldsValuesDecimal_CSharp.xsl
CustomFieldsValuesDecimal_sp.xsl
CustomFieldsValuesDecimal_tbl.xsl
CustomFieldsValuesDecimal_VisualBasic.xsl
CustomFieldsValuesInteger_CSharp.xsl
CustomFieldsValuesInteger_sp.xsl
CustomFieldsValuesInteger_tbl.xsl
CustomFieldsValuesInteger_VisualBasic.xsl
CustomFieldsValuesString_CSharp.xsl
CustomFieldsValuesString_sp.xsl
CustomFieldsValuesString_tbl.xsl
CustomFieldsValuesString_VisualBasic.xsl
CustomFieldsValues_DELETE_sp.xsl
CustomFieldsValues_SELECT_sp.xsl
CustomFields_all.xsl
CustomFields_CSharp_util.xsl
CustomFields_sp.xsl
CustomFields_tbl.xsl
CustomFields_VisualBasic_util.xsl
DACCustomFields_CSharp.xsl
DACCustomFields_VisualBasic.xsl
GetPrimaryKeyColumnName_sp.xsl
GetPropertyListValues_fn.xsl
GetTableCustomFieldsXML_sp.xsl
select_custom_fields_type.xsl
vwCustomFields.xsl
DACExample_CSharp.xsl
DACExample_VisualBasic.xsl
DataAccessComponent_CSharp_Odbc.xsl
DataAccessComponent_CSharp_OleDb.xsl
DataAccessComponent_CSharp_SQL.xsl
DataAccessComponent_VisualBasic_Odbc.xsl
DataAccessComponent_VisualBasic_OleDb.xsl
DataAccessComponent_VisualBasic_SQL.xsl
DataAccessContainer_CSharp_Odbc.xsl
DataAccessContainer_CSharp_OleDb.xsl
DataAccessContainer_CSharp_SQL.xsl
DataAccessContainer_VisualBasic_Odbc.xsl
DataAccessContainer_VisualBasic_OleDb.xsl
DataAccessContainer_VisualBasic_SQL.xsl
DataAccess_PHP.xsl
dataset_schema.xsl
dataset_template.xsx
execRoutine_CSharp_SQL.xsl
execRoutine_VisualBasic_SQL.xsl
fnGetExtendedProperty_fn.xsl
GetRoutineParametersXML_sp.xsl
GetTableColumnsXML_sp.xsl
GET_NEXT_ID_sp.xsl
html.xsl
KeyTables_tbl.xsl
Libraries
CustomFields.dll
DACCreator.dll
DataGridCustomColumns.dll
DotNetScripting.dll
Odbc
DataAccessComponent.dll
DataAccessContainer.dll
OleDb
DataAccessComponent.dll
DataAccessContainer.dll
RJS.Web.WebControl.PopCalendar.dll
SQL
DataAccessComponent.dll
DataAccessContainer.dll
msaccess_2_sql.xsl
mysql_2_sql.xsl
select_type.xsl
simpleDAC_CSharp_Odbc.xsl
simpleDAC_CSharp_OleDb.xsl
simpleDAC_CSharp_SQL.xsl
simpleDAC_JScript_SQL.xsl
simpleDAC_PHP.xsl
simpleDAC_VB60_SQL.xsl
simpleDAC_VBScript_SQL.xsl
simpleDAC_VisualBasic_Odbc.xsl
simpleDAC_VisualBasic_OleDb.xsl
simpleDAC_VisualBasic_SQL.xsl
simpleDAC_WebUI_CSharp.xsl
simpleDAC_WebUI_VisualBasic.xsl
simpleDAC_WinUI_CSharp.xsl
simpleDAC_WinUI_VisualBasic.xsl
split.xsl
sp_ora.xsl
sp_sql.xsl
sp_sql_create_table.xsl
sp_sql_historic.xsl
sp_sql_insert_rows.xsl
sp_sql_search.xsl
sp_sql_select_by_pk.xsl
WebForm.xsl
WebUserControl.xsl
WindowsForm_resx.xsl
Xdo.ConnectionStringProject.dll
dacbuilder_src.zip
DACBuilder_src
App.ico
arrow_down.bmp
CustomFields
DACBuilder.csproj.user
Templates
connection_strings
Access.xsl
AS400(iSeries).xsl
DBF - FoxPro.xsl
DSN.xsl
Excel.xsl
Exchange.xsl
Firebird.xsl
IBM DB2.xsl
Informix.xsl
Ingres.xsl
Interbase.xsl
Lightbase.xsl
Mimer SQL.xsl
MySQL.xsl
Oracle.xsl
Paradox.xsl
Pervasive.xsl
PostgreSQL.xsl
SQL Server 2005.xsl
SQL Server.xsl
Sybase.xsl
Text.xsl
UDL.xsl
Visual FoxPro.xsl
CustomFields
CustomFieldsPropertyList_sp.xsl
CustomFieldsPropertyList_tbl.xsl
CustomFieldsProperty_sp.xsl
CustomFieldsProperty_tbl.xsl
CustomFieldsSecurity_sp.xsl
CustomFieldsSecurity_tbl.xsl
CustomFieldsTableColumn_SELECT_ByFKTable_sp.xsl
CustomFieldsTableColumn_sp.xsl
CustomFieldsTableColumn_tbl.xsl
CustomFieldsTable_SELECT_ByName_sp.xsl
CustomFieldsTable_sp.xsl
CustomFieldsTable_tbl.xsl
CustomFieldsType_insert.xsl
CustomFieldsType_sp.xsl
CustomFieldsType_tbl.xsl
CustomFieldsValueList_sp.xsl
CustomFieldsValueList_tbl.xsl
CustomFieldsValuesBool_CSharp.xsl
CustomFieldsValuesBool_sp.xsl
CustomFieldsValuesBool_tbl.xsl
CustomFieldsValuesBool_VisualBasic.xsl
CustomFieldsValuesDateTime_CSharp.xsl
CustomFieldsValuesDateTime_sp.xsl
CustomFieldsValuesDateTime_tbl.xsl
CustomFieldsValuesDateTime_VisualBasic.xsl
CustomFieldsValuesDecimal_CSharp.xsl
CustomFieldsValuesDecimal_sp.xsl
CustomFieldsValuesDecimal_tbl.xsl
CustomFieldsValuesDecimal_VisualBasic.xsl
CustomFieldsValuesInteger_CSharp.xsl
CustomFieldsValuesInteger_sp.xsl
CustomFieldsValuesInteger_tbl.xsl
CustomFieldsValuesInteger_VisualBasic.xsl
CustomFieldsValuesString_CSharp.xsl
CustomFieldsValuesString_sp.xsl
CustomFieldsValuesString_tbl.xsl
CustomFieldsValuesString_VisualBasic.xsl
CustomFieldsValues_DELETE_sp.xsl
CustomFieldsValues_SELECT_sp.xsl
CustomFields_all.xsl
CustomFields_CSharp_util.xsl
CustomFields_sp.xsl
CustomFields_tbl.xsl
CustomFields_VisualBasic_util.xsl
DACCustomFields_CSharp.xsl
DACCustomFields_VisualBasic.xsl
GetPrimaryKeyColumnName_sp.xsl
GetPropertyListValues_fn.xsl
GetTableCustomFieldsXML_sp.xsl
select_custom_fields_type.xsl
vwCustomFields.xsl
DACExample_CSharp.xsl
DACExample_VisualBasic.xsl
DataAccessComponent_CSharp_Odbc.xsl
DataAccessComponent_CSharp_OleDb.xsl
DataAccessComponent_CSharp_SQL.xsl
DataAccessComponent_VisualBasic_Odbc.xsl
DataAccessComponent_VisualBasic_OleDb.xsl
DataAccessComponent_VisualBasic_SQL.xsl
DataAccessContainer_CSharp_Odbc.xsl
DataAccessContainer_CSharp_OleDb.xsl
DataAccessContainer_CSharp_SQL.xsl
DataAccessContainer_VisualBasic_Odbc.xsl
DataAccessContainer_VisualBasic_OleDb.xsl
DataAccessContainer_VisualBasic_SQL.xsl
DataAccess_PHP.xsl
dataset_schema.xsl
dataset_template.xsx
execRoutine_CSharp_SQL.xsl
execRoutine_VisualBasic_SQL.xsl
fnGetExtendedProperty_fn.xsl
GetRoutineParametersXML_sp.xsl
GetTableColumnsXML_sp.xsl
GET_NEXT_ID_sp.xsl
html.xsl
KeyTables_tbl.xsl
Libraries
CustomFields.dll
DACCreator.dll
DataGridCustomColumns.dll
DotNetScripting.dll
Odbc
DataAccessComponent.dll
DataAccessContainer.dll
OleDb
DataAccessComponent.dll
DataAccessContainer.dll
RJS.Web.WebControl.PopCalendar.dll
SQL
DataAccessComponent.dll
DataAccessContainer.dll
msaccess_2_sql.xsl
mysql_2_sql.xsl
select_type.xsl
simpleDAC_CSharp_Odbc.xsl
simpleDAC_CSharp_OleDb.xsl
simpleDAC_CSharp_SQL.xsl
simpleDAC_JScript_SQL.xsl
simpleDAC_PHP.xsl
simpleDAC_VB60_SQL.xsl
simpleDAC_VBScript_SQL.xsl
simpleDAC_VisualBasic_Odbc.xsl
simpleDAC_VisualBasic_OleDb.xsl
simpleDAC_VisualBasic_SQL.xsl
simpleDAC_WebUI_CSharp.xsl
simpleDAC_WebUI_VisualBasic.xsl
simpleDAC_WinUI_CSharp.xsl
simpleDAC_WinUI_VisualBasic.xsl
split.xsl
sp_ora.xsl
sp_sql.xsl
sp_sql_create_table.xsl
sp_sql_historic.xsl
sp_sql_insert_rows.xsl
sp_sql_search.xsl
sp_sql_select_by_pk.xsl
WebForm.xsl
WebUserControl.xsl
WindowsForm_resx.xsl
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DACBuilder.CustomFields
{

	public class DACCustomFieldsProperty
	{
		public DACCustomFieldsProperty()
		{
		}
        
		#region Private members
        
		
		private int		xPKProperty = -1;

		private int		xFKPropertyType = -1;

		private int		xFKColumn = -1;

		private string		xDefaultValue = string.Empty;

		private string		xPropertyName = string.Empty;

		private int		xFKPropertyList = -1;

		
		private DataRow xCustomFieldsPropertyRow;

		#endregion

		#region Properties
		
		
		public int  PKProperty
		{
			get
			{
				return xPKProperty;
			}
			set
			{
				xPKProperty = value;
			}
		}

		public int  FKPropertyType
		{
			get
			{
				return xFKPropertyType;
			}
			set
			{
				xFKPropertyType = value;
			}
		}

		public int  FKColumn
		{
			get
			{
				return xFKColumn;
			}
			set
			{
				xFKColumn = value;
			}
		}

		public string  DefaultValue
		{
			get
			{
				return xDefaultValue;
			}
			set
			{
				xDefaultValue = value;
			}
		}

		public string  PropertyName
		{
			get
			{
				return xPropertyName;
			}
			set
			{
				xPropertyName = value;
			}
		}

		public int  FKPropertyList
		{
			get
			{
				return xFKPropertyList;
			}
			set
			{
				xFKPropertyList = value;
			}
		}

		
		public DataRow CustomFieldsPropertyRow
		{
			get
			{
				return xCustomFieldsPropertyRow;
			}
		}
		
		#endregion
		
		#region Connection
		
		
		private string cnnString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]; 
		private SqlConnection cnn;

		private void OpenConnection()
		{
			cnn = new SqlConnection(cnnString);
			cnn.Open();
		}

		private void CloseConnection()
		{
			cnn.Close();
		}

		public string ConnectionString
		{
			get
			{
				return cnnString;
			}
			set
			{
				cnnString = value;
			}
		}

		
		#endregion
		
		#region Standard methods
		
		

		public bool Add()
		{
			OpenConnection();
			
			SqlCommand cmd = new SqlCommand("CustomFieldsProperty_INSERT", cnn);
			cmd.CommandType = CommandType.StoredProcedure;
				
			SqlParameter param;
			
			param = new SqlParameter("@FKPropertyType", SqlDbType.Int);
			param.Value = xFKPropertyType;
			cmd.Parameters.Add(param);

			param = new SqlParameter("@FKColumn", SqlDbType.Int);
			param.Value = xFKColumn;
			cmd.Parameters.Add(param);

			param = new SqlParameter("@DefaultValue", SqlDbType.VarChar, 1000);
			param.Value = xDefaultValue;
			cmd.Parameters.Add(param);

			param = new SqlParameter("@PropertyName", SqlDbType.VarChar, 100);
			param.Value = xPropertyName;
			cmd.Parameters.Add(param);

			param = new SqlParameter("@FKPropertyList", SqlDbType.Int);
			if( xFKPropertyList == -1)
				param.Value = DBNull.Value;
			else
				param.Value = xFKPropertyList;
			cmd.Parameters.Add(param);

			int result = cmd.ExecuteNonQuery();
			CloseConnection();
			
			return result > 0;
		}

		public bool Edit()
		{
			OpenConnection();
			
			SqlCommand cmd = new SqlCommand("CustomFieldsProperty_UPDATE", cnn);
			cmd.CommandType = CommandType.StoredProcedure;
				
			SqlParameter param;
			
			param = new SqlParameter("@PKProperty", SqlDbType.Int);
			param.Value = xPKProperty;
			cmd.Parameters.Add(param);

			param = new SqlParameter("@FKPropertyType", SqlDbType.Int);
			param.Value = xFKPropertyType;
			cmd.Parameters.Add(param);

			param = new SqlParameter("@FKColumn", SqlDbType.Int);
			param.Value = xFKColumn;
			cmd.Parameters.Add(param);

			param = new SqlParameter("@DefaultValue", SqlDbType.VarChar, 1000);
			param.Value = xDefaultValue;
			cmd.Parameters.Add(param);

			param = new SqlParameter("@PropertyName", SqlDbType.VarChar, 100);
			param.Value = xPropertyName;
			cmd.Parameters.Add(param);

			param = new SqlParameter("@FKPropertyList", SqlDbType.Int);
			if( xFKPropertyList == -1)
				param.Value = DBNull.Value;
			else
				param.Value = xFKPropertyList;
			cmd.Parameters.Add(param);

			int result = cmd.ExecuteNonQuery();
			CloseConnection();
			return result > 0;
		}
		
		public bool Delete()
		{
			OpenConnection();
			
			SqlCommand cmd = new SqlCommand("CustomFieldsProperty_DELETE", cnn);
			cmd.CommandType = CommandType.StoredProcedure;
				
			SqlParameter param;
			
			param = new SqlParameter("@PKProperty", SqlDbType.Int);
			param.Value = xPKProperty;
			cmd.Parameters.Add(param);

			int result = cmd.ExecuteNonQuery();
			CloseConnection();
			return result > 0;
		}

//		public bool DeleteByFKPropertyType()
//		{
//			OpenConnection();
//			
//			SqlCommand cmd = new SqlCommand("CustomFieldsProperty_DELETE_ByPropertyType", cnn);
//			cmd.CommandType = CommandType.StoredProcedure;
//				
//			SqlParameter param;
//			
//			param = new SqlParameter("@FKPropertyType", SqlDbType.Int);
//			param.Value = xFKPropertyType;
//			cmd.Parameters.Add(param);
//
//			int result = cmd.ExecuteNonQuery();
//			CloseConnection();
//			return result > 0;
//		}
				
		public bool Read()
		{
			OpenConnection();
			
			SqlCommand cmd = new SqlCommand("CustomFieldsProperty_SELECT", cnn);
			cmd.CommandType = CommandType.StoredProcedure;
				
			SqlParameter param;
			
			param = new SqlParameter("@PKProperty", SqlDbType.Int);
			param.Value = xPKProperty;
			cmd.Parameters.Add(param);

			SqlDataAdapter adapter = new SqlDataAdapter();
			adapter.SelectCommand = cmd;
			DataTable dt = new DataTable("CustomFieldsProperty");
			adapter.Fill(dt);
			CloseConnection();
			if(dt.Rows.Count > 0)
			{
				DataRow dr = dt.Rows[0];
				xCustomFieldsPropertyRow = dr;
				
				xPKProperty = (int)dr["PKProperty"];

				xFKPropertyType = (int)dr["FKPropertyType"];

				xFKColumn = (int)dr["FKColumn"];

				xDefaultValue = dr["DefaultValue"].ToString();

				xPropertyName = dr["PropertyName"].ToString();

				xFKPropertyList = dr["FKPropertyList"] == DBNull.Value ? -1 : (int)dr["FKPropertyList"];

				return true;
			}
			return false;
		}



		
		public DataTable ReadCustomFieldsTypeCustomFieldsProperty()
		{
			OpenConnection();
			
			SqlCommand cmd = new SqlCommand("CustomFieldsProperty_CustomFieldsType_S", cnn);
			cmd.CommandType = CommandType.StoredProcedure;
				
			SqlParameter param = new SqlParameter("@FKPropertyType", SqlDbType.Int);
			param.Value = xFKPropertyType;
			cmd.Parameters.Add(param);
			SqlDataAdapter adapter = new SqlDataAdapter();
			adapter.SelectCommand = cmd;
			DataTable dt = new DataTable("CustomFieldsType_CustomFieldsProperty");
			adapter.Fill(dt);
			CloseConnection();
			return dt;
		}

		public DataTable ReadCustomFieldsTableColumnCustomFieldsProperty()
		{
			OpenConnection();
			
			SqlCommand cmd = new SqlCommand("CustomFieldsProperty_CustomFieldsTableColumn_S", cnn);
			cmd.CommandType = CommandType.StoredProcedure;
				
			SqlParameter param = new SqlParameter("@FKColumn", SqlDbType.Int);
			param.Value = xFKColumn;
			cmd.Parameters.Add(param);
			SqlDataAdapter adapter = new SqlDataAdapter();
			adapter.SelectCommand = cmd;
			DataTable dt = new DataTable("CustomFieldsTableColumn_CustomFieldsProperty");
			adapter.Fill(dt);
			CloseConnection();
			return dt;
		}

		public DataTable ReadCustomFieldsPropertyListCustomFieldsProperty()
		{
			OpenConnection();
			
			SqlCommand cmd = new SqlCommand("CustomFieldsProperty_CustomFieldsPropertyList_S", cnn);
			cmd.CommandType = CommandType.StoredProcedure;
				
			SqlParameter param = new SqlParameter("@FKPropertyList", SqlDbType.Int);
			param.Value = xFKPropertyList;
			cmd.Parameters.Add(param);
			SqlDataAdapter adapter = new SqlDataAdapter();
			adapter.SelectCommand = cmd;
			DataTable dt = new DataTable("CustomFieldsPropertyList_CustomFieldsProperty");
			adapter.Fill(dt);
			CloseConnection();
			return dt;
		}

		
		#endregion
		
		
		#region Other DAC logic
		
		#endregion
		
	}
		
}

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)

About the Author

Dan Radu
Web Developer
Romania Romania
I live and work in Bucharest, Romania. I am programmer since 1998, when I have developed a "good taste" application for a catering company. Now I develop .NET applications (windows and ASP.NET) for large SQL Server database systems, with tens of millions of records.
I like to develop also in other languages like Object Pascal (Delphi), PHP, C++, VB, scripting. I enjoy the XML power, both on client side and server side.

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 31 Mar 2006
Article Copyright 2006 by Dan Radu
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid