I'll add that your quotes can be confusing for the sql driver.
You could either remove them or encase the servername only.

Either
    private string conns = "Data Source =  MOI-PC\SQLEXPRESS; Initial
Catalog = Project; User ID = sa; Password = madurai; Connect Timeout =
60;";
or
    private string conns = "Data Source =  'MOI-PC\SQLEXPRESS';
Initial Catalog = Project; User ID = sa; Password = madurai; Connect
Timeout = 60;";
should work.

On 24 août, 19:51, stanlei <[email protected]> wrote:
> i've been trying this for days and i just dont know what the problem
> is ...
>
> im using:
>
> private string conns = "Data Source = 'MOI-PC/SQLEXPRESS;Initial
> Catalog = Project; User ID = sa; Password = madurai'; Connect Timeout
> =  60;";
>
> SqlConnection conn = new SqlConnection(conns);
>             conn.ConnectionString = conns;
>
>             try
>             {
>                 conn.Open();
>             }
>             catch (Exception ex)
>             {
>
>                 MessageBox.Show("ERROR \n"+ex.Message);
>             }
>
> All i get is ..
>
> A network-related or instance-specific error occurred while
> establishing a connection to SQL Server. The server was not found or
> was not accessible. Verify that the instance name is correct and that
> SQL Server is configured to allow remote connections. (provider: Named
> Pipes Provider, error: 40 - Could not open a connection to SQL Server)
>
> I use Windows Vista Ultimate SP2, SQL server 2005 SP3 and Visual
> Studio 2005
> sql server is configured to accept remote connections .... both tcp/ip
> n named pipes
> my sql browser is running ....
>
> any help would be greatly appreciated!!

Reply via email to