codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Stored procedure return no recordset  Mediterranean at 01:38 on Thursday, December 04, 2003
 

Hi,

I run a Sybase stored procedure (with parameters) from Excel using ADODB Connetction but it returns an empty recordset.
However, if I run a stored procedure (with no parameters), it works fine.
Can anyone help me?
Thanks.

Below is my code:
Dim v_This_Row As Variant, v_Last_Row As Variant, _
v_This_Col As Variant, v_Last_Col As Variant

Dim CN As New ADODB.Connection
Dim RecSet As New Recordset
Dim Query As String

Dim strConn As String
strConn = "DSN=dbname;UID=username;PWD=pwd"

CN.ConnectionString = strConn
CN.Open

Dim sFac As String, sProduct As String
Dim iSwitch As Integer

sFac = "Fac"
sProduct = "Prod"
iSwitch = 2

Query = "execute WARS_UDB..p_aps_prodrteoper3_seq "
Query = Query & "'" & sFac & "', " & "'" & sProduct & "', " & iSwitch

Set RecSet = CN.Execute(Query)

Dim v_Col_Count
v_Col_Count = RecSet.Fields.Count


For v_This_Col = 0 To (v_Col_Count - 1)
Cells(1, v_This_Col + 1) = RecSet.Fields(v_This_Col).Name
Next v_This_Col

v_This_Row = 2
Do While Not RecSet.EOF
For v_This_Col = 0 To (v_Col_Count - 1)
Cells(v_This_Row, v_This_Col + 1) = RecSet(v_This_Col)
Next v_This_Col
RecSet.MoveNext
v_This_Row = v_This_Row + 1
Loop
'get the last row
v_Last_Row = v_This_Row - 1

RecSet.Close

CN.Close









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo
•  Cookies and Threads C++
•  right justify a background in a table?
•  Help with Loop (C++/MFC)
•  Help with Loop (C++/MFC)


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007