vb6 call recordset from sql server 2000 - working until using parameters - then empty recordset
- From: aaapaul <lvpaul@xxxxxxx>
- Date: Fri, 05 Oct 2007 05:12:08 -0700
I want to get a adodb.recordset back from a stored procedure:
Without parameters it works fine:
CREATE PROCEDURE sp_SuchenAuftragsdokumente
as
SELECT
barcode,doctyp
FROM
Saperion.DEF_KUNDE k
WHERE
k.barcode like 'VTA%'
GO
Private Sub Command2_Click()
Dim Conn1 As ADODB.Connection
Dim Cmd1 As ADODB.Command
Dim Rs1 As ADODB.Recordset
Dim sp As String
sp = "sp_SuchenAuftragsdokumente"
Set Conn1 = New ADODB.Connection
Conn1.ConnectionString = "Provider=SQLOLEDB.1;Password=ccc;Persist
Security Info=True;User ID=sa;Initial Catalog=Saperion;Data
Source=archivtest"
Conn1.Open
Set Cmd1 = New ADODB.Command
With Cmd1
.ActiveConnection = Conn1
.CommandType = adCmdStoredProc
.CommandText = sp
End With
Set Rs1 = Cmd1.Execute
Set Me.VSFlexGrid1.DataSource = Rs1
Rs1.Close
Conn1.Close
Set Rs1 = Nothing
Set Conn1 = Nothing
End Sub
But If I am adding an input parameter,
sp:
(
@aufnr varchar(12)
)
the recordset comes back, too - but all fields are empty - its
amazing:
My both trials dont work
'dont work
' .Parameters.Append .CreateParameter("@aufnrz", adVarChar,
adParamInput, 12, "XXXX")
'dont work
' .Parameters.Refresh
' .Parameters("@aufnr").Value = "test"
Any idea?
Thanks
aaapaul
.
- Follow-Ups:
- Prev by Date: Re: How do you get excel to calculate using ADO?
- Next by Date: Re: vb6 call recordset from sql server 2000 - working until using parameters - then empty recordset
- Previous by thread: How do you get excel to calculate using ADO?
- Next by thread: Re: vb6 call recordset from sql server 2000 - working until using parameters - then empty recordset
- Index(es):
Relevant Pages
|