R
Ron
I am getting an error that procedure SP_Getpayments expects paramter
@studentid
What I am trying to do with this is execute the stores procedure that
is just this....
(
@studentid int
)
as
select *
from tblpayments
where studentid = @studentid
GO
I want to get everything from tblpayments and display it ina listbox
lstsearch on my form. Here is the code I have and I am getting the
above error. Can anyone tell me what I am doing wrong?
Dim rst As New ADODB.Recordset
Dim Cnn As New ADODB.Connection
Dim cmd As ADODB.Command
Set rst = New ADODB.Recordset
Set Cnn = New ADODB.Connection
Set cmd = New ADODB.Command
ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;PersistSecurity Info=False;User
ID=xxx;password=xxx;Initial Catalog=xxx;Data Source = psbeh18"
Cnn.Open ConnectionString
Set cmd.ActiveConnection = Cnn
cmd.CommandText = "sp_getPayments"
cmd.CommandType = adCmdStoredProc
Set rst = cmd.Execute
Set prmstudentid = cmd.CreateParameter("@studentid", adBigInt,
adParamInput, , [Forms]![frmPayments]![txtsearchid])
rst.Open cmd
Do Until rst.EOF
With Me.lstsearch
.AddItem rst.Fields(0)
.Column(1, ListCount - 1) = rst.Fields(1)
End With
rst.MoveNext
Loop
rst.Close
Cnn.Close
Set rst = Nothing
Set Cnn = Nothing
Set cmd = Nothing
End Sub
@studentid
What I am trying to do with this is execute the stores procedure that
is just this....
(
@studentid int
)
as
select *
from tblpayments
where studentid = @studentid
GO
I want to get everything from tblpayments and display it ina listbox
lstsearch on my form. Here is the code I have and I am getting the
above error. Can anyone tell me what I am doing wrong?
Dim rst As New ADODB.Recordset
Dim Cnn As New ADODB.Connection
Dim cmd As ADODB.Command
Set rst = New ADODB.Recordset
Set Cnn = New ADODB.Connection
Set cmd = New ADODB.Command
ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;PersistSecurity Info=False;User
ID=xxx;password=xxx;Initial Catalog=xxx;Data Source = psbeh18"
Cnn.Open ConnectionString
Set cmd.ActiveConnection = Cnn
cmd.CommandText = "sp_getPayments"
cmd.CommandType = adCmdStoredProc
Set rst = cmd.Execute
Set prmstudentid = cmd.CreateParameter("@studentid", adBigInt,
adParamInput, , [Forms]![frmPayments]![txtsearchid])
rst.Open cmd
Do Until rst.EOF
With Me.lstsearch
.AddItem rst.Fields(0)
.Column(1, ListCount - 1) = rst.Fields(1)
End With
rst.MoveNext
Loop
rst.Close
Cnn.Close
Set rst = Nothing
Set Cnn = Nothing
Set cmd = Nothing
End Sub