Reputation:
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?
Upvotes: 2
Views: 1054
Reputation: 3206
"Object reference not set to an instance of an object" is usually an indicator of not using the Keyword "New".
Upvotes: 0
Reputation: 15011
Via code would be something like:
var conn = new SqlConnection([connectionString]);
conn.Open();
Upvotes: 1