Sunday, March 6, 2011

Adding a data connection to SQL Server 2008 from VS 2008

Im trying to add a connection to a database in SQL Server 2008 using Visual Studio 2008. When testing the connection, it says that it is successful. However, once I said okay, it complains and say: "Cannot add data connection. Object reference not set to an instance of an object."

How do I go about adding a data connection to a SQL Server 2008 using Visual Studio 2008?

From stackoverflow
  • Via code would be something like:

    var conn = new SqlConnection([connectionString]);
    conn.Open();
    
  • "Object reference not set to an instance of an object" is usually an indicator of not using the Keyword "New".

0 comments:

Post a Comment