Dtabase sql server 2005 come file

giovedì 05 gennaio 2006 - 17.44

diska Profilo | Newbie

nel mio progetto asp.net 2.0 ho il db usato come file locale

quando chiamo il metodo open e mi dice che

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)


il codice è questo


Dim conn As New System.Data.SqlClient.SqlConnection

Dim builder As New System.Data.SqlClient.SqlConnectionStringBuilder()

builder.DataSource = "Data Source=.\SQLEXPRESS"
builder.AttachDBFilename = "ASPNETDB.MDF"
builder.IntegratedSecurity = True
builder.UserID = "nomepc\utente"

System.Diagnostics.Debug.WriteLine(builder.ConnectionString)

conn.ConnectionString = builder.ConnectionString



Dim adapter As New System.Data.SqlClient.SqlDataAdapter("select * from User", conn)
Dim tbuser As New Data.DataSet


conn.Open()
qui mi da l'errore


se tento la connessione con i tool di visual studio va a buon fine anche sul file locale

diska Profilo | Newbie

mi rispondo da solo che idiota

ho scritto builder.DataSource = "Data Source=.\SQLEXPRESS"

invece di builder.DataSource = ".\SQLEXPRESS"

Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5