Visual C# 2008 Express connection to SQL Server 2008 Express Issue

Phil picture Phil · May 22, 2009 · Viewed 14.4k times · Source

I have a problem with Visual C# 2008 express (SP1) connecting to SQL Server 2008 express. The "Add Connection" window (wherever initiated) doesn't list existing sql server and no option for sql server except a compact edition.

Note that, I've got the VWD 2008 express (SP1) on the same machine which shows the window regularly (with SQL server listed) and SQL Server Management studio works fine with the server as well.

I've seen other similar posts, did take some advices: reinstalled the VC#, services run ok, etc... but with no success with VC# so far.

Again, on the same machine the VWD shows the dialog with sql server option regularly, but VC# shows only 3 options in "Change data source" dialog (1. Microsoft Access Database File (OLE DB) 2. Microsoft SQL Server Compact 3.5, 3. Microsoft SQL Server Database File)

Any idea?

Answer

Rat1960 picture Rat1960 · Jan 17, 2010

I am with Phil on this Visual Web Developer 2008 Express Tools>Connect to Database... brings up Add Connection dialog with Server name:

Visual C# 2008 Express has Database file name (new or existing):

This rather implies using ado.net programatically

as in SqlConnection db = new SqlConnection(); db.ConnectionString= ...

"Data Source=.\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=True; providerName=System.Data.SqlClient";

[Data Source=server\SQLEXPRESS] I seem to have ASPNETDB.MDF files that have been created in my project areas but do not confuse these with

C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\master.mdf

MVS.NET 2003 required Microsoft SQL Server 2000 Desktop Engine ontop of SQL Server 2000. It all rather reminds me of using Microsoft Access to Attach to SQL Server via ODBC as a means of getting 'bound controls' in Access Basic.