Bison Infosolutions Knowledgebase
Protect your Lenovo Server
Contact WhatsApp

Fix Error 20599 “Cannot Open SQL Server” in VB6 / Crystal Reports Applications – Complete Troubleshooting Guide

The error “Error Number: 20599 – Cannot open SQL server” is a common issue in legacy business applications built using VB6, ODBC, and Crystal Reports. This error typically occurs when the application fails to establish a connection with the SQL Server database.

It is especially common in environments where:

  • Multiple SQL Server instances are installed
  • Systems are migrated (physical → cloud server)
  • ODBC / DSN configurations are outdated
  • Crystal Reports runtime dependencies are mismatched

This article provides a step-by-step technical approach to identify and fix the issue effectively.


⚠️ Error Description

Error Message:

Error Number: 20599
Error Description: Cannot open SQL server
Module: JobRouteCard
Procedure: tbMenu_ButtonClick

? Meaning:

The application attempted to:

  • Connect to SQL Server
  • Fetch data (often for reports)

But failed due to:

  • Incorrect connection settings
  • Database unavailability
  • Authentication or network issues


? Root Causes

1. SQL Server Instance Mismatch

Systems with multiple instances like:

  • MSSQLSERVER (Default)
  • SQLEXPRESS
  • SQLEXPRESS01

The application may be pointing to the wrong instance.


2. SQL Server Service Issues

If SQL services are:

  • Stopped
  • Hung
  • Misconfigured

Connection will fail.


3. ODBC / DSN Misconfiguration

Legacy applications depend on:

  • 32-bit ODBC Data Sources

Incorrect DSN settings lead to connection failure.


4. Database Not Attached or Missing

After migration:

  • Database may not be attached
  • MDF/LDF files may be missing


5. Authentication Failure

  • Invalid SQL username/password
  • SQL Authentication disabled
  • Permission issues


6. Network / Firewall Restrictions

When SQL is hosted on another machine:

  • Port 1433 blocked
  • SQL Browser disabled
  • Server not reachable


7. Crystal Reports Runtime Issues

If the error occurs while opening reports:

  • Missing runtime
  • Version mismatch (CR 8.5 vs newer runtime)


? Step-by-Step Troubleshooting

✅ Step 1: Verify SQL Services

  1. Open services.msc
  2. Ensure:
    • SQL Server (MSSQLSERVER) → Running
    • SQL Server (SQLEXPRESS) → Running
    • SQL Server Browser → Running


✅ Step 2: Identify Correct SQL Instance

Open SQL Server Management Studio (SSMS) and test:

localhost
.\SQLEXPRESS
.\SQLEXPRESS01
SERVERNAME
SERVERNAME\SQLEXPRESS

✔ Use the instance that connects successfully


✅ Step 3: Verify Database Availability

In SSMS:

  • Expand Databases
  • Confirm:
    • Database exists
    • Database is online

If missing:

Right Click → Attach Database


✅ Step 4: Check Authentication

Try both:

  • Windows Authentication
  • SQL Server Authentication

Ensure:

  • Login exists
  • Password correct
  • User mapped to database


✅ Step 5: Verify ODBC Configuration

Open 32-bit ODBC:

C:\Windows\SysWOW64\odbcad32.exe

Check:

  • System DSN
  • Correct server name
  • Database selected

✔ Click Test Connection


✅ Step 6: Validate Network Connectivity

If using remote SQL Server:

ping SERVERNAME

Test using IP:

192.168.1.10\SQLEXPRESS

Also ensure:

  • Port 1433 open
  • Firewall allows SQL


✅ Step 7: Check Crystal Reports Runtime

If error occurs on report click:

  • Install correct runtime version
  • Ensure compatibility with application
  • Reconfigure report datasource


? Special Case: Server Migration (Physical → Cloud)

Common issues after migration:

  • Old server name still used
  • DSN not updated
  • Database path changed
  • SQL instance renamed

✔ Solution:

  • Update connection string
  • Recreate ODBC DSN
  • Verify database attach


⚡ Quick Fix Checklist

✔ SQL Server running
✔ Correct instance used
✔ Database attached
✔ Login working
✔ ODBC DSN correct
✔ Network accessible
✔ Crystal runtime installed


? Conclusion

Error 20599 – Cannot open SQL server is not a software bug but a configuration issue. It typically arises due to mismatched SQL instance names, incorrect ODBC settings, or database connectivity failures.

By systematically verifying:

  • SQL services
  • Instance name
  • Authentication
  • ODBC configuration

You can resolve the issue quickly and restore application functionality.


#SQLServer #Error20599 #DatabaseError #VB6 #CrystalReports #ODBC #SQLConnection #SQLEXPRESS #MSSQLSERVER #SQLTroubleshooting #DatabaseConnection #SQLFix #ServerError #SQLAdmin #ITSupport #SQLIssues #DatabaseFix #SQLGuide #SSMS #SQLLogin #SQLAuthentication #ODBCError #CrystalReportError #SQLMigration #CloudServer #SQLNetwork #SQLFirewall #SQLPort1433 #SQLBrowser #SQLInstance #SQLHelp #TechSupport #SQLDatabase #SQLRepair #SQLSetup #SQLConfiguration #SQLDebugging #SQLServerError #DatabaseAdmin #SQLSolutions #SQLProblems #SQLSupport #SQLTech #SQLExpert #SQLTips #SystemAdmin #SQLTools #SQLRuntime #SQLConnectivity #SQLFixGuide


SQL Server error 20599 cannot open SQL server VB6 database error crystal reports SQL error ODBC connection issue SQL server instance problem MSSQLSERVER vs SQLEXPRESS SQL connection failed database not attached SQL SQL authentication failed ODBC
Sponsored