Connect to Database...

I have install the Northwind sample database by entering at the DOS prompt

osql -E -S (local)\sqlexpress -i instnwnd.sql

which runs through lots of numbers so I assume has all gone ok.

When in VS I go to "Tools/Connect to Database...", choose "Microsoft SQL Server" and ".NET Framework Data Provider for SQL Server", then in the next dialog there is one server in the combo which I select, but I cannot get any databases to appear in the "Select or enter a database name" combo.

[543 byte] By [Chardiot] at [2007-12-25]
# 1

I think you need a SqlServer software is installed in your machine

and in c# you type sever name on combobox like: (local)

then your database name will appear

DongMT at 2007-9-3 > top of Msdn Tech,Visual C#,Visual C# General...
# 2

I do have SQLExpress installed and the configuration manager is on my Windows Start Menu which shows "SQL Server (SQLExpress)" as running but "SQL Server Browser" is stopped. Is this correct?

If I type in (local) I get an error message occurred while establishing a connection to server.

Chardiot at 2007-9-3 > top of Msdn Tech,Visual C#,Visual C# General...
# 3

sorry,I do not use Sqlexpress

? server= . / sqlexpress ( no spaces)

may www.connectionstrings.com helps you....

this info bellow help you?

..........................................

Hi
I'm trying to connect to SQLExpress database. I'm using c# express and it's sqlexpress that came with it.
I want to use OleDbConnection but I can't fiqure out what is the right connection string. The database file is in the project folder (local).
Using the follwing connection String :
@"Provider=SQLNCLI.1;Integrated Security=true;Persist Security Info=False;AttachDbFilename=|DataDirectory|\Database1.mdf;Data Source=.\SQLEXPRESS";

Returns the following error:
Could not connect to data source: No error message available.

Help please?

SqlConnection myConnection = new SqlConnection("server=CS-DD928D0CB525\\SQLEXPRESS;" +

  "Trusted_Connection=yes;" +

"database=master;" +

"connection timeout=30");


................................

SQLExpress should work just like SQL Server. Why are you using OleDb? You should be using a SQLConnection.

DongMT at 2007-9-3 > top of Msdn Tech,Visual C#,Visual C# General...
# 4
I don't know what this script will do on SqlExpres DB engine. I never test this with SQL Express and maybe it will not work. First of all how will you specify database path and file name. Maybe if you manualy create a database from Visual Studio and then change the script (Delete database create part) and also change connection string for osql where you need to specify database path. Then maybe will work.
boban.s at 2007-9-3 > top of Msdn Tech,Visual C#,Visual C# General...
# 5

maybe you can check the sqlpress first on you PC by below methodes.

1. is there is folder C:\Program Files\Microsoft SQL Server\90\Tools\Binn ?

2. check the service named SQL Server (SQLEXPRESS)

liuyann at 2007-9-3 > top of Msdn Tech,Visual C#,Visual C# General...
# 6
I checked these out and whilst doing that adjusted some other setting. Finally seem to have got it working so thanks for all the help
Chardiot at 2007-9-3 > top of Msdn Tech,Visual C#,Visual C# General...