|
-
Jan 9th, 2001, 04:23 AM
#1
Thread Starter
Lively Member
I've set up a linked server to the Index Service. Using the debugger in SQL i've tested my sproc and it returns the filename & size of various files.
On the UI side, if I attach an adodc to the sproc and a datacombo to the adodc i get a recordset returned. But, if I attempt to do this through a recordset I get -1 records returned.
Any ideas?
 VB6 Enterprise sp5, SQL Server2000 
-
Jan 9th, 2001, 05:13 AM
#2
Fanatic Member
How are you attempting to get the data from the sp? I would suspect it is the way in which you are calling the sp and how you are using the parameters collection. Could you post the code and maybe the sp itself?
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Jan 9th, 2001, 05:34 AM
#3
Thread Starter
Lively Member
Here's the sproc
CREATE proc spDocumentsInHoldingPool
as
SELECT *
FROM OpenQuery(roverholdingarea,
'SELECT FileName, DocAuthor,Size
FROM SCOPE('' "e:\ftptesting\rover\holdingpool" '')
WHERE FileName LIKE ''%.%''
order by FileName '
)
I've tried every permutation of opening a recordset known to Man. ie passing in a string as a connection, trying to use a command object etc
Whats really bugging me is that I can pull back the records using an adodc control then Set recordset=adodc1.recordset and this works!
 VB6 Enterprise sp5, SQL Server2000 
-
Jan 9th, 2001, 06:08 AM
#4
Fanatic Member
Can you show me some of the code you are using to get the data back? I just want to see how you are approaching it.
There really shouldn't be a problem.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Jan 9th, 2001, 08:14 AM
#5
Thread Starter
Lively Member
Private Sub Command3_Click()
Dim con As ADODB.Connection
Dim rs3 = New ADODB.Recordset
Set con = New ADODB.Connection
Set rs3 = New ADODB.Recordset
con.ConnectionString = "Provider=SQLOLEDB.1;" & _
"Initial Catalog=Rover;Data Source=xxxx.xxxx.xxxx.xxxx;" & _
"Password=xxxxxxxxxxxx;User ID=RoverAdministration"
con.CursorLocation = adUseClient
con.Open
Set cmd.ActiveConnection = con
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "spDocumentsInHoldingPool"
rs3.Open "exec spdocumentsinholdingpool", con, , adCmdStoredProc
Set DataCombo3.RowSource = rs3
DataCombo3.ListField = "filename"
Debug.Print "rs3 " & rs3.RecordCount
End Sub
The above code results in -2147467900 'The command contained one or more errors'.
 VB6 Enterprise sp5, SQL Server2000 
-
Jan 9th, 2001, 08:27 AM
#6
Fanatic Member
I have never done it that way.
Try:
Dim con As ADODB.Connection
Dim rs3 = New ADODB.Recordset
Set con = New ADODB.Connection
Set rs3 = New ADODB.Recordset
con.ConnectionString = "Provider=SQLOLEDB.1;" & _
"Initial Catalog=Rover;Data Source=xxxx.xxxx.xxxx.xxxx;" &_
"Password=xxxxxxxxxxxx;User ID=RoverAdministration"
con.CursorLocation = adUseClient
con.Open
cmd.CommandText = "spDocumentsInHoldingPool"
cmd.CommandType = adCmdStoredProc
cmd.Name = "MyLocalSP"
Set cmd.ActiveConnection = con
con.MyLocalSP rs3
Set DataCombo3.RowSource = rs3
DataCombo3.ListField = "filename"
My bit is in bold (obviously).
Let me know if it works for you.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Jan 9th, 2001, 08:43 AM
#7
Thread Starter
Lively Member
Didn't work I'm afraid.
error - -2147467900 'The command contained one or more errors'.
 VB6 Enterprise sp5, SQL Server2000 
-
Jan 9th, 2001, 08:57 AM
#8
Fanatic Member
V. Strange,
why not try the connection method against a simple SELECT sp, ensure that that works first. This is odd but I have never used OpenQuery in an sp before.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Jan 9th, 2001, 08:59 AM
#9
Thread Starter
Lively Member
I tried that earlier, it works fine.
Arrgggghhhhh!
 VB6 Enterprise sp5, SQL Server2000 
-
Jan 9th, 2001, 09:22 AM
#10
Thread Starter
Lively Member
Err Oops!
I hadn't set the linked servers permissions.
I can now use
rs.open "exec spxxx",cn
but I get 0 records returned
 VB6 Enterprise sp5, SQL Server2000 
-
Jan 9th, 2001, 09:30 AM
#11
Fanatic Member
/slap
Ok. What about my way of connecting? Does that work? You've got me worried now.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|