Results 1 to 6 of 6

Thread: Connecting to 32bit SQL Server Express 2008 with C#, can only compile as x86

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Iowa
    Posts
    73

    Question Connecting to 32bit SQL Server Express 2008 with C#, can only compile as x86

    Using SQLOLEDB as a provider, I have found that when connecting to a 32 bit server, I have to compile as x86 application. I'm assuming it has something to do with the providers being 32 and 64 bit. When I compile as Any CPU or x64, the application starts but does not connect. Instead, I receive the following exception:

    An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll

    Additional information: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

    When I compile as x86, it connects fine. I also found that if I compile it as Any CPU or x86 and run it on a Win7-32 installation, it works and connects. Targeting Any CPU and running it on Win7-64 will not connect. The Win7-32 computer is also the machine hosting the SQL Server.

    Why will it not connect from my Win7-64 machine when targetting Any CPU but works as expected when the same executable is run on Win7-32? Alternatively, will I see any issues if I compile as x86 and try to connect to a 64 bit server?

    My connection string just for S's & G's:
    Code:
    Provider=SQLOLEDB;Data Source=server\instance;Initial Catalog=database;Integrated Security=SSPI;
    Also tried SQLNCLI11 with same result, but would rather not be so specific.

    Thanks for any input you can offer!
    Last edited by sdouble; Oct 16th, 2013 at 12:23 PM. Reason: spacing, misspelling

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width