Re: Help on Connection Code

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Val Mazur (group51a_at_hotmail.com)
Date: 06/01/04


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
> 


Relevant Pages

  • SQL Permission question
    ... I would like to know what the permissions should be for the following ... letting everyone have full contol of this folder. ... Here is the error message that I am recieving. ... "Unable to load SQL Server OLEDB provider dll. ...
    (microsoft.public.sqlserver.security)
  • Re: SQL Permission question
    ... It seems that dll is corrupted. ... > needs Full Control permissions for everyone. ... > Here is the error message that I am recieving. ... > "Unable to load SQL Server OLEDB provider dll. ...
    (microsoft.public.sqlserver.security)
  • Re: SQL Server and Creating Tables/Queries
    ... I get an error message ... > with the Software that I got my database from? ... This is a permissions issue. ... If you are not the SQL Server DBA, ask her to make you a user on the ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Cant Login on a sql2005 machine from VS2005 IDE debug mode
    ... Assume the SQL Server in box A is set up correctly (can be accessed from network. ... What is the ConnectionString used by the app? ... examine the permissions assigned to the SQL Server login/database user to see if the user has appropriate permission to the data (SELECT... ... it cant login to the tables using the ...
    (microsoft.public.dotnet.general)
  • Transactional Replication is not starting the snapshot
    ... Please can you post up the entire error message. ... probably an issue regarding the visibility of the repldata ... share or a permissions issue, but the error text will help ... Paul Ibison SQL Server MVP, ...
    (microsoft.public.sqlserver.replication)