我需要你的幫助。C#連接到mysql服務器
我這是說的錯誤消息:
"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)".
我試圖連接使用的IP其它本地計算機本地主機。 我的代碼:
public DbStudent()
{
UGIcon = new SqlConnection();
UGIcon.ConnectionString = "server= IPAddress;user="id";password="pass";database=MyDB";
}
public SqlConnection Open()
{
UGIcon.Open();
return UGIcon;
}
public void Close()
{
UGIcon.Close();
}
請問有人能幫我嗎?
你的標題具有的MySql而你的錯誤是關於SQL Server的,你想用'SqlConnection'連接到MySQL數據庫嗎? – Habib 2013-03-11 08:00:25
是的,有可能嗎?或者你可以給我另一種方式來連接mysql? – Wiranata 2013-03-11 08:02:31
我不明白你的代碼是如何編譯的:你的連接字符串包含未轉義引號...... – Kek 2013-03-11 08:03:08