- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在处理本地项目并尝试连接到本地数据库。我在连接字符串中有这个类:
public class SQLConnection
{
public static string connectionString =
@"Data Source=TZVIKA-PC\SQLEXPRESS;Initial Catalog=WorldCup;Integrated Security=True";
public static WorldCupDBDataContext wcDataContext =
new WorldCupDBDataContext(connectionString);
public static WorldCupDBDataContext GetDataContextInstance()
{
return wcDataContext;
}
}
当我尝试在 Windows 窗体中执行这一行时:
teamBindingSource.DataSource = database.Teams.OrderBy(team => team.TeamId);
我得到以下 sql 异常:
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)
我的 friend 运行了代码,它在他的电脑上运行(当然是将连接字符串更改为相关字符串时)
为什么它对我不起作用?
最佳答案
测试 SQL 连接是否正常工作的一种好(且简单)方法是使用 .UDL 文件。只需在桌面上创建一个空文本 (.txt) 文件并将扩展名重命名为 .udl。双击,您将看到一个 SQL 连接窗口,填写详细信息,测试连接,然后(当它工作时)保存。关闭窗口并将文件扩展名重命名为 .txt。打开并在里面你会找到你的工作连接字符串。
关于c# - 错误 - 尝试连接到 sql server 数据库时出现 "The server was not found or was not accessible",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20300623/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!