C:\Users\Pawel\Documents\DB.sdf
numaralı dosyada veritabanım var. Buna nasıl bağlanabilirim?.sdf veritabanına bağlanmaya çalışırken istisna
Aşağıdaki basit kod çalışmıyor ve istisna oluşturuyor.
Kodu:
[WebMethod]
public String TestCon()
{
SqlConnection sql = new System.Data.SqlClient.SqlConnection(
@"Data Source=C:\Users\Pawel\Documents\DB.sdf");
string str = "OK";
try
{
sql.Open();
sql.Close();
}
catch (Exception ex)
{
str = ex.Message;
}
return str;
}
Sonuç:
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
ben eksik? Bağlantıyı doğru şekilde açmak için ne yapmalıyım?
DÜZENLEME:
System.NotSupportedException: SQL Server Compact is not intended for ASP.NET development.
Büyük: P
SqlCompact kullanıyor musunuz? Normal SQL İstemcisi'ni kullanıyorsunuz görünüyor –