Visual Studio 2005 - OleDbConnection throws "Invalid authorization specification" in Form Designer,

Posted by Jason Dagit on Stack Overflow See other posts from Stack Overflow or by Jason Dagit
Published on 2009-05-27T15:43:37Z Indexed on 2010/04/20 8:03 UTC
Read the original article Hit count: 431

I have a form with an OleDbConnection object on it. This form fails to load in the Form Designer with the message:

One or more errors encountered while loading the designer. 
The errors are listed below. Some errors can be fixed by rebuilding your project, 
while others may require code changes.

Invalid authorization specification 
   at ADODB.ConnectionClass.Open(String ConnectionString, String UserID, String Password, Int32 Options)
   ... (stack trace continues into user code)

I've tracked this down to the OleDbConnection string. If I hardcode in the server IP, username/password/dbinstance into the constructor of the GUI form then the form will load in the designer. At run-time it is not an issue because we require the user to provide the login details.

The question:

Is it possible to use the OleDbConnection and the Form designer without supplying the database credentials in the source code of the form? For example, is there a property of the OleDbConnection or Form that I can set so that it doesn't need to access the database during Form design?

My concern is that if we ever move the database server or change the login that the code will stop working in the designer.

© Stack Overflow or respective owner

Related posts about visual-studio-2005

Related posts about vb.net