INSTRON
Norwood, MA, U.S.A (09/2008 - 03/2009)
Senior Programmer: My role was to create a mapping model to interface the proprietary software BLUEHILL . I developed the dynamic linking library (dll) module named MappingDataSet which imports data dynamically from the client database via an XML file. The imported data is processed via client interface and exported to a database dynamically.
The nice feature of this tool was the creation of the database tables and columns dynamically as needed. The software was developed primarily on
In another project, I refactored existing UI controls using HTML and Visual Basic 6.0 to meet new user requirements.
Link to INSTRON
Sample Code :
Code for Access database operations
using System; using System.Collections.Generic; using System.Text; using System.Data.OleDb; using System.Data; namespace DatabaseServer { public class Access : Database { //private string accessConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\All Users\\Application Data\\#######\\#######\\Common Files\\#######.#######.mdb"; //public override IDbConnection Open(string connectionString) //{ // return connection; //} public override IDbConnection CreateConnection() { OleDbConnection DbConnection = new OleDbConnection(); return DbConnection; } } }
Sample Code for ADODXDB object operations
using System; using System.Collections.Generic; using System.Text; using ADOX28 = ADOX; using ADODB; using System.Data; using System.Data.OleDb; namespace ADOXDB { class Program { private void Database_CreateValidationResultsTable() { //ADOX.Catalog adoxCatalog = new ADOX.Catalog(); //ADOX.Table adoxTable; //string strDatabase = "C:\\Personal\\MyDatabase.mdb"; //string strTable = "MyTable"; //string strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDatabase + ";Mode=ReadWrite;Persist Security Info=False"; //adoxCatalog.let_ActiveConnection(strConnectionString); ////delete the table if it already exists //try //{ // adoxCatalog.Tables.Delete(strTable); //} //catch (Exception error) //{ // //Will error if the table doesn't exist. Could trap other possible errors like the database being read-only //} //adoxTable = new ADOX.Table(); //adoxTable.Name = strTable; //adoxTable.Columns.Append("FIELD1", ADOX.DataTypeEnum.adDouble, 0); //adoxTable.Columns.Append("FIELD2", ADOX.DataTypeEnum.adDouble, 0); //adoxTable.Columns.Append("FIELD3", ADOX.DataTypeEnum.adVarWChar, 4); //adoxCatalog.Tables.Append(adoxTable); } private void Database_SaveValidationResults() { //Database_CreateValidationResultsTable(); //ADODB.Connection cnn = new ADODB.Connection(); //ADODB.Recordset rst = new ADODB.Recordset(); //string strDatabase = "C:\\Personal\\MyDatabase.mdb"; //string strTable = "MyTable"; //cnn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + strDatabase + "'", "Admin", "", 0); //rst.Open(strTable, cnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockPessimistic, 0); ////foreach (DataGridViewRow row in dgWorkplaces.Rows) ////{ // rst.AddNew(System.Reflection.Missing.Value, System.Reflection.Missing.Value); // rst.Fields["FIELD1"].Value = row.Cells["colMINE"].Value.ToString(); // rst.Fields["FIELD2"].Value = row.Cells["colLEVEL"].Value.ToString(); // rst.Fields["FIELD3"].Value = row.Cells["colWORKPLAC"].Value.ToString(); // rst.Update(System.Reflection.Missing.Value, System.Reflection.Missing.Value); ////} } static void Main(string[] args) { Console.WriteLine("OSVersion: {0}",Environment.OSVersion.ToString()); ADOX.CatalogClass cat = new ADOX.CatalogClass(); //cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" + //"Data Source=C:\\Personal\\NewMDB.mdb;" + //"Jet OLEDB:Engine Type=5"); //Console.WriteLine("Database Created Successfully"); Console.WriteLine("Opening connection"); string datasource = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Personal\\NewMDB.mdb;"; OleDbConnection conn = new OleDbConnection(datasource); conn.Open(); //string primKey = "ALTER TABLE MyTable"; //primKey += " ADD PrimaryCol TEXT CONSTRAINT primecol_pk PRIMARY KEY"; //OleDbCommand newCmd = new OleDbCommand(primKey, conn); //int tblexecuted = newCmd.ExecuteNonQuery(); ADODB.Connection cnn = new Connection(); cnn.Open(conn.ConnectionString, "", "", 0); cat.ActiveConnection = cnn; Console.WriteLine("Creating Table"); ADOX.Table adoxTable = new ADOX.TableClass(); string mytab = "MyTable"; adoxTable = cat.Tables[mytab]; //adoxTable.Name = mytab; //adoxTable.Columns.Append("PrimaryCol", ADOX.DataTypeEnum.adLongVarWChar, 0); //adoxTable.Keys.Append("PrimaryKey", KeyTypeEnum.adKeyPrimary, "PrimaryCol", "", ""); //cat.Tables.Append(adoxTable); //ADOX.TableClass adoxTable = new TableClass(); //adoxTable = cat.Tables["MyTable"]; //adoxTable.Name = "MyTable"; //adoxTable.ParentCatalog = cat; //cat.Tables.Append(adoxTable); //ADOX.ColumnClass adoxPrimary = new ColumnClass(); //adoxPrimary.Name = "PrimaryCol"; //adoxPrimary.Type = ADOX.DataTypeEnum.adInteger; //adoxTable.Columns.Append(adoxPrimary, ADOX.DataTypeEnum.adInteger, 0); //ADOX.KeyClass adoxPrimaryKey = new KeyClass(); //adoxPrimaryKey.Name = "PrimaryKey"; //adoxPrimaryKey.Type = KeyTypeEnum.adKeyPrimary; //adoxPrimaryKey.Columns.Append(adoxPrimaryKey, ADOX.DataTypeEnum.adInteger, 255); //adoxTable.Keys.Append(adoxPrimaryKey, KeyTypeEnum.adKeyPrimary, adoxPrimary, "", ""); //adoxPrimary.Name = "PrimaryCol"; //adoxPrimary.Type = ADOX.KeyTypeEnum.adKeyPrimary; //adoxTable.Columns.Append(adoxPrimary, ADOX.DataTypeEnum.adInteger, 0); //adoxTable.Keys.Append("PrimaryKey",KeyTypeEnum.adKeyPrimary,adoxPrimary, "", ""); Console.WriteLine("Entering loop"); for (int i = 1; i < 4; i++) { ADOX.ColumnClass adoxColumn = new ColumnClass(); adoxColumn.ParentCatalog = cat; adoxColumn.Name = "Column 3 nEW" + i.ToString(); //adoxColumn.Type = ADOX.DataTypeEnum.adDate; //adoxColumn.Type = ADOX.DataTypeEnum.adInteger; adoxColumn.Type = ADOX.DataTypeEnum.adLongVarWChar; //adoxColumn.Attributes = ColumnAttributesEnum.adColNullable; //adoxColumn.Attributes = ColumnAttributesEnum.adColNullable; //adoxColumn.ParentCatalog = cat; adoxColumn.Properties["Jet OLEDB:Hyperlink"].Value = true; adoxTable.Columns.Append(adoxColumn, 0, 0); adoxColumn = null; Console.WriteLine("Column appended"); } //ADOX.ColumnClass adoxColumn = new ColumnClass(); //adoxColumn.Name = "Some New Method"; //adoxColumn.Type = ADOX.DataTypeEnum.adInteger; //adoxColumn.ParentCatalog = cat; //adoxTable.Columns.Append(adoxColumn, ADOX.DataTypeEnum.adInteger, 0); //cnn.BeginTrans(); //cnn.CommitTrans(); //cat = null; //cnn.Close(); ////conn.Close(); //adoxTable = null; ////conn.Open(); // string insertQuery = "INSERT INTO MyTable ([Column 3 nEW1]) VALUES ('#http://www.hotmail.com#') WHERE PrimaryCol = 1"; // try // { // OleDbCommand cmd = new OleDbCommand(insertQuery, conn); // int exec = cmd.ExecuteNonQuery(); // } // catch (OleDbException ex) // { // string msg = ex.Message; // } conn.Close(); //adoxColumn = null; //ADOX.Catalog adoxCatalog = new ADOX.Catalog(); //ADOX.Table adoxTable; //string strDatabase = "C:\\Personal\\MyDatabase.mdb"; //string strTable = "MyTable"; //string strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDatabase + ";Mode=ReadWrite;Persist Security Info=False"; //adoxCatalog.let_ActiveConnection(strConnectionString); ////delete the table if it already exists //try //{ // adoxCatalog.Tables.Delete(strTable); //} //catch (Exception error) //{ // //Will error if the table doesn't exist. Could trap other possible errors like the database being read-only //} //adoxTable = new ADOX.Table(); //adoxTable.Name = strTable; //adoxTable.Columns.Append("FIELD1", ADOX.DataTypeEnum.adDouble, 0); //adoxTable.Columns.Append("FIELD2", ADOX.DataTypeEnum.adDouble, 0); //adoxTable.Columns.Append("FIELD3", ADOX.DataTypeEnum.adVarWChar, 4); //adoxCatalog.Tables.Append(adoxTable); } } }
Code for MappingDataSet operations
using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.OleDb; namespace DatabaseServer { public enum enumDatabaseType { Access } public abstract class Database { private IDbConnection m_Connection; public IDbConnection DbConnection { get { return m_Connection; } set { m_Connection = value; } } public abstract IDbConnection CreateConnection(); ////public abstract string ConnectioinString(); //private string m_ConnectionString; //public string ConnectionString //{ // get // { // return m_ConnectionString; // } // set // { // m_ConnectionString = value; // } //} //public virtual IDbConnection Open(string connectionString) //{ // ConnectionString = connectionString; // return Open(); //} //public virtual IDbConnection Open() //{ // try // { // Connection.Open(); // } // catch (OleDbException ex) // { // Console.WriteLine(ex.Message); // } // return Connection; //} //public virtual void Close() //{ // Connection.Close(); //} //public IDataAdapter public static Database Factory(enumDatabaseType type) { switch (type) { case Access: return new Access(); break; default: return new Access(); } } } }
Code for Testing Database operations
using System; using System.Text; using System.Collections.Generic; using System.Data; using System.Data.OleDb; using Microsoft.VisualStudio.TestTools.UnitTesting; using DatabaseServer; namespace DatabaseServer.Test { /// <summary> /// Summary description for UnitTest1 /// </summary> [TestClass] public class DatabaseTest { public DatabaseTest() { // // TODO: Add constructor logic here // } #region Additional test attributes // // You can use the following additional attributes as you write your tests: // // Use ClassInitialize to run code before running the first test in the class // [ClassInitialize()] // public static void MyClassInitialize(TestContext testContext) { } // // Use ClassCleanup to run code after all tests in a class have run // [ClassCleanup()] // public static void MyClassCleanup() { } // // Use TestInitialize to run code before running each test // [TestInitialize()] // public void MyTestInitialize() { } // // Use TestCleanup to run code after each test has run // [TestCleanup()] // public void MyTestCleanup() { } // #endregion [TestMethod] public void TestDatabaseFactory() { DatabaseServer.Database access = Database.Factory(enumDatabaseType.Access); Assert.IsNotNull(access); } [TestMethod] public void TestDatabaseOpen() { string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\All Users\\Application Data\\Instron\\Bluehill\\Common Files\\export.Source.mdb"; IDbConnection connection = testDB.Open(connectionString); Assert.IsNotNull(connection); Assert.IsInstanceOfType(connection,typeof(IDbConnection)); } } }