none
ERROR [IM002] [Microsoft][ODBC Driver Manager] in VB.NET App with SqlConnection-Class RRS feed

  • Question

  • Hello,

     

    this is my first thread in these great forums and I'm sure someone of you can help me.

     

    I searched the forums for this error and found many posts, but they were al related to a missing DSN-entry or anything like that but I think mine different (or I'm just overlooking something really simple):

     

    I'm developing a litte Application that connects to our SQL Server 2005 Database using the .NET-Class "System.Data.SqlClient.SqlConnection".

     

    When I run the App on my developing machine in runs fine, but when I run it on a client I get following error:

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

     

    I don't understand the sense of this error because I don't use any DSN entries. I establish the connection with information given in my ConnectionString "Server=Servername\Instance;Initial Catalog=databasename;User ID=userid;Password=pw".

     

    There is no DSN that store any further information for this connection. And a default driver can't be specified in a connectionstring for a "System.Data.SqlClient.SqlConnection" because it always uses the "SQL Native Driver" or the "SQL Driver". Not sure wich one is really used

     

    I updated the Native SQL Driver and the sqldrv32.dll on the clients. They now have exactly the same version as my developing machine but still show the same error.

     

    Here is the slice from my source code:

     

    Code Snippet

    Dim SQLConn As New System.Data.SqlClient.SqlConnection("Server=Servername\Instance;Initial Catalog=databasename;User ID=userid;Password=pw")

     

    Dim ComSelect As New System.Data.SqlClient.SqlCommand("StoredProcedureName", SQLConn)

    ComSelect.CommandType = CommandType.StoredProcedure

    SQLConn.Open()

    ComSelect.ExecuteReader()

    SQLConn.Close()

     

     

    I hope someone can help me with this or give me a hint.

     

    Thanks in advance

    Tuesday, November 25, 2008 8:29 AM

Answers

  • I am very doubt that error comes from the posted code. Did you create any data source using Visual Studio .NET? I am suspecting that you have ODBC connection somewhere with your control in your code and it throws an exception.

     

    Tuesday, November 25, 2008 11:41 AM
    Moderator

All replies

  • I am very doubt that error comes from the posted code. Did you create any data source using Visual Studio .NET? I am suspecting that you have ODBC connection somewhere with your control in your code and it throws an exception.

     

    Tuesday, November 25, 2008 11:41 AM
    Moderator
  • I'm such a dork!

    After your post I searched through the whole project and found some old code, I wasn't even aware it was still in use...


    There I tried to open a ODBC-Connection wich caused the error...



    Thanks a lot for the hint! I was totally blind....
    Wednesday, November 26, 2008 8:14 AM