Humprey Evangelista Cogay

My Programming Adventures

November 2010 - Posts

Windows 7 64Bit Microsoft Access 2007 Problem [Solved] "architecture mismatch between the Driver and Application"

I just installed my PC with Windows 7 64bit, Microsoft Office 2007 and Visual Studio 2010. I was trying something and I have decided to use Microsoft Access as my database, After a few minutes I found my self scratching my head because I cannot Connect My App to my MS Access Database because of thess errors

         "The setup routines for the Microsoft Access Driver(*.mdb, *.accdb) ODBC driver could not be found. Please reinstall the driver"

          Errors Found: The specified DSN contains an architecture mismatch between the Driver and Application

 

Here are some screen shots

 

After googling around I found this 2007 Office System Driver: Data Connectivity Components  Just Download and install it.

and I also found this Windows 7 RC ODBC Access driver, So this lead me to C:\Windows\SysWow64. So what I did was to create a DSN File named MyAccessDatabase.dsn using the odbcad32.exe found inside C:\Windows\SysWow64 instead of the Data Sources (ODBC) Applet found under the Administrative Tools Control Panel Folder

Here's the resulting DNS File

      [ODBC]
     DRIVER=Microsoft Access Driver (*.mdb, *.accdb)
     UID=admin
     UserCommitSync=Yes
     Threads=3
     SafeTransactions=0
     PageTimeout=5
     MaxScanRows=8
     MaxBufferSize=2048
     FIL=MS Access
     DriverId=25
     DefaultDir=c:\Data
     DBQ=C:\Data\database.accdb

So this Works Perfectly now Cool

OdbcConnection cnn = new OdbcConnection();
            cnn.ConnectionString = @"filedsn=C:\Data\MyAccessDatabase.dsn;
                                                       Uid=admin;Pwd=password;"
;

            try
            {
                cnn.Open();
                MessageBox.Show(cnn.State.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                cnn.Close();
            }

But if you dont use a File DSN this should Work Fine......

OleDbConnection cnn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=c:\database.accdb;Jet OLEDB:Database Password=password;"
);

 


cnn.open();

Posted: 11-28-2010 10:23 PM by Comgen | with no comments
Filed under: , , ,
Deleting Randomly Named Folders Created by Windows Update[Solved]

    I Updated my Rig and after several days I noticed that some randomly named folder was created on my mobile drive.

I tried to delete the folder but an error message popped out saying that I don't have any permission on the folder, WTH!!! I am the admin of my computer.

 

I tried to take ownership of the folder by checking the security Properties of the folder. After retrying, Major Fail. Then I heard from a friend about this registry tweak that will add "Take Ownership" on your right click menu.

 NOTE: You can also Download the attached file instead of following the instructions below. Just double click on the REG Files


Installation
1. Open Notepad
2. Paste the following code

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\*\shell\runas]
    @="Take Ownership"
    "NoWorkingDirectory"=""

    [HKEY_CLASSES_ROOT\*\shell\runas\command]
    @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
    "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

    [HKEY_CLASSES_ROOT\Directory\shell\runas]
    @="Take Ownership"
    "NoWorkingDirectory"=""

    [HKEY_CLASSES_ROOT\Directory\shell\runas\command]
    @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
    "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"


3. Save the file as Install.Reg

4. Double click Install.Reg

 

 UnInstallation
1. Open Notepad
2. Paste the following code

Windows Registry Editor Version 5.00

    [-HKEY_CLASSES_ROOT\*\shell\runas]

    [-HKEY_CLASSES_ROOT\Directory\shell\runas]


3. Save the file as Install.Reg

4. Double click Install.Reg

 
After taking ownership of the folder using my new "Take Ownership" Menu. and trying to delete the Damn Folder =) Successs......

Note: Tested Under Windows 7

 

Javascript Best Practives References

I've been playing around with some charting controls when I stumble upon a Javascript Problem. Googling Around I found some cool References =)

http://www.youtube.com/watch?v=hQVTIJBZook
http://www.codeproject.com/KB/ajax/AspNetAjaxBestPractices.aspx
http://daptivate.com/archive/2008/02/12/top-10-best-practices-for-production-asp-net-applications.aspx
http://www.javascripttoolbox.com/bestpractices/
http://net.tutsplus.com/tutorials/javascript-ajax/24-javascript-best-practices-for-beginners/

 

I'll Be updating this page from time to time =)... Just comment for additions....