SQL fails to be recognized by Visual C# Express 2005

I recently installed Beta 2 of VCSE and also the SQL Server Express Edition, and after being unable to complete some tasks I required that SQL Express couldn't handle, I decided to uninstall it, and install my copy of SQL Server 2000 Dev on the machine instead.

Now, VCSE fails to recognize the SQL Server that I installed, and when using the "Add New Connection" Wizard, I am unable to connect to the correct server. If I click on Advanced, the DataSource field is set to .\SQLExpress, and I am unable to change it. Is there some way to correct this issue?

Any help would be greatly appreciated. Thanks ^_^

[612 byte] By [DaisukeNiwa] at [2008-2-6]
# 1
Daisuke Niwa wrote:
I recently installed Beta 2 of VCSE and also the SQL Server Express Edition, and after being unable to complete some tasks I required that SQL Express couldn't handle, I decided to uninstall it, and install my copy of SQL Server 2000 Dev on the machine instead.

Now, VCSE fails to recognize the SQL Server that I installed, and when using the "Add New Connection" Wizard, I am unable to connect to the correct server. If I click on Advanced, the DataSource field is set to .\SQLExpress, and I am unable to change it. Is there some way to correct this issue?

Any help would be greatly appreciated. Thanks ^_^


Daisuke,

I believe for server installs of SQL Server (not express), you can use (local) for the instance, and it should work.

I am curious, what was SQL Express not able to do?

Hope this helps.

- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

casperOne at 2007-8-21 > top of Msdn Tech,Visual C#,Visual C# General...
# 2
I have the same problem. I installed C#express beta 2 version than i install SQL 2000 Personal. When i wannt to add connection to sql it gives me error like:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

I am choosing a database which was created before. Path is like that: C:\Program Files\Microsoft SQL Server\MSSQL\Data\northwind.mdf

Error is the same.

When i want to create a new database called new.mdf , Error is the same.

I do the same things on Web Developer Express Beta 2 and everything is ok. It's working perfect. But C# gonna make me crazy. HEEEEELLLLP PLSSSS

MasterG at 2007-8-21 > top of Msdn Tech,Visual C#,Visual C# General...
# 3
Hi,
Remote data access are only available on VS Standard and above. It seems that the Express Products (C++,C#,VB) could only access SSE and Microsoft Access locally. The express products are mainly created for hobbyist, if you want to have more tools, I suggest using Standard Edition or the higher products...
BTW, I tried connecting to my SQLServer on Visaul Studio Beta1 and it works perfectly... (Still waiting for a copy of VSTS)
cheers,
Paul June A. Domag
PaulDomag at 2007-8-21 > top of Msdn Tech,Visual C#,Visual C# General...
# 4
I have exactly the same problem with VB express...Sad
JDGingras at 2007-8-21 > top of Msdn Tech,Visual C#,Visual C# General...
# 5
Hi all,

Well, honestly it took me a while before I was able to figure out what it was all about. Actually it's that the VC# Express and VB Express are not designed to work with the SQL Server 2000 from within the IDE. Only SQL Server 2005 Express Edition and MS Access databases can be accessed from within the IDE. That's all there's to it.

But there's another way out. You can connect to and manipulate data of SQL Server 2000 from within code. To connect to the Pubs database of SQL Server 2000 and display the data from the Authors table in a datagrid use code similiar to the following:



// -Load event of your Form-

// Init connection to the pubs database running on local SQL Server.
// If connecting to a remote server use this naming scheme:
// server_name\sql_server_instance_name
SqlConnection pubsConn = new SqlConnection();
pubsConn.ConnectionString = "Data Source=(local);Initial Catalog=Pubs;Integrated Security=SSPI;Persist Security Info=False";

// Init data adapter and select command
SqlCommand pubsSelCmd = pubsConn.CreateCommand();
pubsSelCmd.CommandType = CommandType.Text;
pubsSelCmd.CommandText = "SELECT * FROM Authors";
SqlDataAdapter pubsAdapter = new SqlDataAdapter(pubsSelCmd);

// Fill the data into DataSet
DataSet pubsDataSet = new DataSet();
pubsAdapter.Fill(pubsDataSet, "Authors");

// Display in the on-form DataGrid
dgPubs.DataSource = pubsDataSet;
dgPubs.DataMember = "Authors";

I hope this helps.

Regards,

Ejan

Ejan at 2007-8-21 > top of Msdn Tech,Visual C#,Visual C# General...