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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Server 6.5/7.0

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-28 : 23:50:57
Linda writes "The code below runs without problems from a Word 97 application connecting to a SQL Server 6.5 Database. If I run the same code using a SQL Server 7.0 Database the application crashes as soon as I try to open the record set.I get a Doctor Watson Error. What could be causing this problem? The application runs under Windows NT 4.0 SP5.

Here is the code:


Dim Ws As Workspace
Dim Db As database
Dim rs As Recordset
Dim strConnect, strSQL As String

hostComputer = Environ("COMPUTERNAME")
Set Ws = CreateWorkspace("", "", "", dbUseODBC)
Let strConnect = "ODBC" & ";DATABASE=" & strDbName & ";uid=" & genUser & ";PWD=" & genPassword & ";DSN=" & strDbName
Set Db = Ws.OpenDatabase(strDbName, , , strConnect)
Let strSQL = "select distinct db_name(dbid), SUSER_NAME(suid) from master.dbo.sysprocesses where master.dbo.sysprocesses.hostname = '" & hostcomputer & "'"
Set rs = Db.OpenRecordset(strSQL, dbOpenForwardOnly)

rs.Close
Db.Close
Ws.Close

"
   

- Advertisement -