ERROR this line connect.Open()
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Preliminary correction
Windows start print: SQL Server Configuration Manager Topic: SQL Server Network Configuration > Protocols for XXXXXX Check: TCP/IP (Status = Enabled) > Click right TCP/IP: Properties Tab: IP Addresses > Topic: IP All > set TCP Port: 1433 (winKey + r)run > services.msc > restart services
If still not working, check firewall
Control Panel > Windows Defender Firewall > Turn off Windows Defender firewall (not recommended)
Original problem > Click
Thankyou > https://stackoverflow.com/