locked
Odbc Problem

    Question

  • Hello everybody, i have a problem with my application. I moved my project from my old pc to my new pc.

    Some code of my project:

    OdbcCommand cmd;
                DataSet ds;
                System.Data.Odbc.OdbcDataAdapter da;
                string
     MyString;
                using
     (OdbcConnection cn = new
     OdbcConnection())
                {
                    cn.ConnectionString = ("dsn=mydsn;"
    );
                    ds = new
     DataSet();
    
                    MyString = "SELECT user FROM users"
    ;
                    da = new
     System.Data.Odbc.OdbcDataAdapter(MyString, cn.ConnectionString);
                    cmd = new
     OdbcCommand(MyString, cn);
                    da.Fill(ds, "active"
    );
                    foreach
     (DataRow dRow in
     ds.Tables["users"
    ].Rows)
                    {
                        
                        usercombo.Items.Add(dRow.ItemArray.GetValue(0).ToString());
                    }
    
                }
    
    In my new pc my application does not work.... When i try to debug my application i get the error:

    ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    at this line of code -> da.Fill(ds, "active");

    I tried a lot of things but none of them worked... i deleted my dataset and re-add it i deleted my connection to the database and did it again, nothing worked....

    The mydsn exists, i have installed odbc driver..

    any ideas?

    Friday, October 16, 2009 11:37 PM

Answers

  • this solved my problem.....


    In a 64 bit windows server operating system, there are TWO odbc managers. When you pull up the usual menu for the odbc / dsn system, it is for the 64 bit odbc manager, and 32 bit applications will not work using these dsn's.

    This is where the 32 bit odbc manager is:

    C:\Windows\SysWOW64\odbcad32.exe
    • Proposed as answer by Yort Sunday, October 18, 2009 7:39 AM
    • Marked as answer by nobugzMVP, Moderator Sunday, October 18, 2009 4:05 PM
    Sunday, October 18, 2009 12:45 AM

All replies

  • invader7,

    Please, check if your DSN name is correct and if you've created a system DSN and not a file DSN.

    Best regards.

    Ari C. Raimundo
    Saturday, October 17, 2009 2:58 AM
  • already checked thanks for answer
    Saturday, October 17, 2009 12:21 PM
  • this solved my problem.....


    In a 64 bit windows server operating system, there are TWO odbc managers. When you pull up the usual menu for the odbc / dsn system, it is for the 64 bit odbc manager, and 32 bit applications will not work using these dsn's.

    This is where the 32 bit odbc manager is:

    C:\Windows\SysWOW64\odbcad32.exe
    • Proposed as answer by Yort Sunday, October 18, 2009 7:39 AM
    • Marked as answer by nobugzMVP, Moderator Sunday, October 18, 2009 4:05 PM
    Sunday, October 18, 2009 12:45 AM