VB中使用cryRpt1.LogOnServer "p2ssql.dll", sname, dbname, ServerUid, ServerPwd
有時會出現20536 Unable to logon to server的錯誤
解決方法
1 把sname改成IP可以通過
2
In Windows XP.
Click Start.
Click Control Panel.
Click Administrative Tools.
Click Data Sources (ODBC).
Click User DSN tab.
In the Name column, click the connection your Crystal Report is using.
Click Configure...
Check that both Name and Server have the correct values.
Click Next.
Here is the fix that worked for us - under "How should SQL Server verify ..." change the selection from "With SQL Server authentication..." to "With Windows NT authentication...". This is the only change we had to make to fix Run-time error '20536':
Of course, check that the other settings are correct and continue to click Next until you get to the last form and then click Finish.
Click Test Data Source ... you should see TESTS COMPLETED SUCCESSFULLY!