Re: Help on Connection Code
From: Val Mazur (group51a_at_hotmail.com)
Date: 06/01/04
- Next message: Tausif: "ADO Error"
- Previous message: Val Mazur: "Re: close recordset before nothing"
- In reply to: Peter Newman: "Help on Connection Code"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 1 Jun 2004 18:17:39 -0400
Hi Peter,
What is the error message? If it is related to the permissions, then check
if your user, which logs on to Windows, has permissions to run a this stored
procedure
-- Val Mazur Microsoft MVP "Peter Newman" <anonymous@discussions.microsoft.com> wrote in message news:C3A95E07-2BA4-4E13-8295-F21A0FA7925A@microsoft.com... > Im running VB6 (SP6) and SQL 2000. I have a Stored Procedure on the SQL > server that generates a Recordset of clients & details to be invoiced. Ive > looked through the help systems and have come up with the following code > which works fine on my laptop connecting to a local SQL server, but doesnt > work on my XP workstation connecting to our Live SQL server. I have a > trusted connection and hold Full system rights. Can anyone make any > suggestions on what the problem may be or how to track down the error ? > > > Dim InvRSet As ADODB.Recordset > Dim ConnectionString As String > On Error GoTo ErrorTrap > > Set UserDBConnect = New ADODB.Connection > Set InvRSet = New ADODB.Recordset > > ' Connect to the Server > UserDBConnect.ConnectionTimeout = 60 > UserDBConnect.Provider = "SQLoleDB" > ConnectionString = > "Server=10.10.1.60;Database=Bossdata;Trusted_Connection=Yes" > UserDBConnect.Open ConnectionString > > Debug.Print "Logon SQL Server = TRUE" > ' I have logged on to the server > > 'Set InvCodesRSet = New ADODB.Recordset > InvRSet.CursorLocation = adUseClient > > ' i dont know how to check why this fails > InvRSet.Open "BuildInvDataSet", UserDBConnect, adOpenStatic, > adLockOptimistic, adCmdStoredProc > > ' this throws an error as the record set is not open > Debug.Print InvRSet.RecordCount > > ' Clean up > Set InvRSet = Nothing > Set UserDBConnect = Nothing > Exit Sub > ErrorTrap: > > ErrString = ((CStr(Err.number * -1)) + ";" + Err.Description + ";" + > Err.Source) > Debug.Print ErrString >
- Next message: Tausif: "ADO Error"
- Previous message: Val Mazur: "Re: close recordset before nothing"
- In reply to: Peter Newman: "Help on Connection Code"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|