Clear, accurate, high quality discussion

Forum

 
ForumForumDiscussions and...Discussions and....Net framework ....Net framework ...Add an SQL Database to a VS project.Add an SQL Database to a VS project.
Previous Previous
 
Next Next
New Post
 02/04/2008 17:49
 

Hi all,

I've got "VS 2005 Pro Edition" and "SQL Server 2005 Standard".

When I try to add an SQL Database as a New Item I get the following error message:
Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly.

I've set the SQL Server Instance Name under Tools~Database Tools~Data Connections to "MSSQLSERVER" & "D9DQQF3J" & "D9DQQF3J/DARREN" but I keep getting the error message.

The only solutions I've found when searching google have been to change the instance name as above, but obviously this hasn't worked.
When I installed VS I selected not to install SQL Server Express as I had the standard version.

Could anyone give me a solution that doesn't require having standard and express installed please?

Many thanks in advance,
Darren.

 

 

New Post
 02/04/2008 19:04
 

Hi Darren,

When you use 'real' SQL Server (as opposed to SQL Server Express) I don't think it's usual to add the database itself as part of the project.  Instead you have a connection string, usually in the config file, which specifies where the SQL Server instance is to be found and what database to use.

This is often handled as you add (say) a SqlDatasource to your web form (I'm assuming it's a web project).  In the wizard you tell it what database to use and it offers to save the connection string in the config file.

 


Cheers,
- Richard
If this post helped you over a problem, or taught you something new, please login and rate it. Ratings are in the drop down in the top left corner
New Post
 04/04/2008 17:44
 

Sorry, didn't realise the post had been replied to - I thought I'd ticked the email me option.

I was just creating a Windows Application to play around with C# & SQL Server.
As you've suggested, I ended up creating the database in SQL Server Management Studio and adding the completed database as a data source to my project.

I just found it strange that there was this option (as directed in the book I'm reading - Head First C#) which only seems to work with SQL Server Express.
Nevermind though, it's not something I can think I'll ever have to do - create a database at runtime.

Thanks for the reply,
Darren.

Previous Previous
 
Next Next
ForumForumDiscussions and...Discussions and....Net framework ....Net framework ...Add an SQL Database to a VS project.Add an SQL Database to a VS project.

Forum Usage Guidelines

The forums are a place for all to exchange ideas and techniques, and to post and answer questions.  All are welcome to read, registration is required to post. 

If you learn somthing new, discover or acquire a new technique, then please take a moment to register and rate the post that just helped you.  This site does not send spam and it does not release your personal details.  Full details in the site privacy policy.

We have some simple posting guidelines to keep the forums a pleasant and informative environment.

  • No flames, no trolls
  • No profanity, no racism
  • Site management has the final word on approving or removing any thread, post, or comment
  • English language only please