-
Notifications
You must be signed in to change notification settings - Fork 23
Description
UWP with C# at vs2019
i'm trying to link the mssqlserver by the following connstr ,but it always return error(as the end)
im sure i can link the sql server with ssms at another pc ,
also can link the server @ my WPF ,WinForm Project .
this uwp peoject also can open the webpage by httpclient
who can tell me what's wrong?
Data Source=192.168.100.51,1433\MSSQLSERVER;User Id=sa;Password=123456;
Data Source=192.168.100.51\MSSQLSERVER;User Id=sa;Password=123456;
Data Source=192.168.100.51\MSSQLSERVER,1433;User Id=sa;Password=123456;
Data Source=192.168.100.51,1433;User Id=sa;Password=123456;
Data Source=192.168.100.51,1433;User Id=sa;Password=123456;
Data Source=192.168.100.51,1433;User Id=sa;Password=123456
Data Source=192.168.100.51,1433;User Id=sa;pwd=123456
Data Source=192.168.100.51;User Id=sa;pwd=123456
public Boolean LinkState(Boolean WorkDBTest=false)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = SQL_ConnStr;
try
{
conn.Open();
conn.Close();
Debug.WriteLine("MSSQL Conn Opened:" + conn.ConnectionString);
Debug.WriteLine("MSSQL Conn Str:" + conn.ServerVersion);
return true;
}
catch (Exception ex)
{
Debug.WriteLine("MSSQL Conn Str:" + conn.ConnectionString);
Debug.WriteLine("MSSQL Conn Str:" + conn.DataSource);
Debug.WriteLine("MSSQL Conn EX:"+ex.Message);
return false;
}
}
MSSQL Conn EX: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: TCP Provider, error: 40 - Could not open a connection to SQL Server)