Hi,
I'm working on a multi user VB.Net windows application with back end as SQL Server 2008 Express. The SQL Server is installed on the intranet network drive. This is the connection string I will be using. Is this correct?

Data Source=.\SQLEXPRESS;AttachDbFilename=Q:\Database\PrintDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True

Thanks

Sorry, I have changed the connection string to this, as the SQL server is installed in a network server and the database is placed in the local D: drive of the server. This is the connection string.

"Data Source=ServerName\SQLEXPRESS;Database=D:\PrintRequestDatabase\PrintDB. mdf;Trusted_Connection=True;"

The error I get is 'Cannot open database ......'

The easist way to connect to a database is as follows

Driver={sql server};trusted_connection=yes;server=servername\SQLEXPRESS;database=database name

Just make sure you have no spaces in the string. You can you this method to connect with any server on your network provided you have peermission to do so. Your program does not need to know the physical location of the database - SQL Server takes care of this.

Thanks all for your help. I solved it. I think I had messed with the user permission in the database. I deleted the database file and recreated a new one in the remote server. And it works!

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.