I'm building a windows forms application in Visual Studio 2008. I've set-up a SQL server 2008 .MDF database and attached it to my project. All the data is stored, used, shown etc and seems to work fine.
However, when I debug the project (for the first time!) or publish it I get a' timeout expired' error.
I think it is becuase I haven't explicity opened the connection to the database in code.
If I check the .MDF properties before and after I manually click the database in the Server Explorer, I can see that the database properies 'State' changes from closed to open and then I don't get the error. However, I need to fix for publishing.
How do I open this connection in VB.Net? ( .Net 3.5 )