尝试从 c# 连接到 sql server,使用格式
private void ConnectToSQL()
{
string connectionString = @"Data Source= ____;Initial Catalog=____;User ID=_____;Password=_____";
using (SqlConnection objSqlConnection = new SqlConnection (connectionString))
{
try {
objSqlConnection.Open();
objSqlConnection.Close();
Response.Write("Connection is successfull");
}
catch (Exception ex)
{
Response.Write("Error : " + ex.Message.ToString());
}
}
}
如何从 Management Studio 中找到数据源和初始目录。无法建立连接。