Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Cannot Connect To SQL Server

Author  Topic 

apantig
Posting Yak Master

104 Posts

Posted - 2006-01-15 : 20:40:29
Hi guys,

Thank you for your recent help to me.

3 of our users have been experiencing this error message when loading selected reports from VB6 that were written in Crystal Report.
We use MS SQL Server 7.

"Cannot Connect To Sql Server"

Some users load the same report but no error was prompting. These 3 users have been using the selected reports for years and just only now receiving this error.

This is also my first time to encounter this. I suggested them to restart their computer but the same problem persists.

What shall we do?

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-01-15 : 21:09:05
Check the Data source in the Crystal Report
-- check whether its properly selected
-- if not create a new connection with proper table names etc.

Also if there is a DSN (data source name) in Crystal Report Data source,
-- Check that in DSNs as well.
-- Try to connect to the DB by a VB application with the same connection method as in Crystal Report
Go to Top of Page

apantig
Posting Yak Master

104 Posts

Posted - 2006-01-15 : 21:50:34
This is how I execute report in Crystal from VB6

Set cr1 = New crAdvancesToCustomersAccounting
Set cn = ADOConnect(sDBServer, sDBName)
Set rs1 = cn.Execute("pr_AdvancesToCustomersSLAccountingReport '" & sBuyerCode
& "'")
cr1.Database.SetDataSource rs1
cr1.ReadRecords

... then the report will display now.



Public Function ADOConnect(s_DBServer As String, s_DBName As String) As ADODB.Connection
On Error GoTo ErrorTrap
Dim cnNew As New ADODB.Connection
Set cn = Nothing
Set ADOConnect = Nothing
cnNew.CursorLocation = adUseClient
cnNew.CommandTimeout = 0
cnNew.Provider = "SQLOLEDB"
cnNew.Open "Server=" & s_DBServer & ";Database=" & s_DBName, "SA", ""
If cnNew.State = adStateClosed Then
GoTo ErrorTrap
Else
Set ADOConnect = cnNew
End If
Exit Function
ErrorTrap:
Set ADOConnect = Nothing
ErrorHandler "E0001"
End Function




Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-01-16 : 02:25:23
see this

www.connectionstrings.com
Go to Top of Page
   

- Advertisement -