Click to See Complete Forum and Search --> : Procedure or function "sched2" has too many parameters specified.


akshay2711
March 25th, 2006, 03:37 AM
===akki===

Anybody please help.

I am getting Error:
Procedure or function "sched2" has too many parameters specified.


// this function is called on page load and current date

is passed as parameter

Private Sub virtable(ByVal caldate As Date)

// virtable creates a datatable, fetches data to six

datasets thru fetchdataset() procedures and show results in gridview.

fetchdset1(caldate)
fetchdset2(caldate)
fetchdset3(caldate)
fetchdset4(caldate)
fetchdset5(caldate)
fetchdset6(caldate)

Private Sub fetchdset1(ByVal caldate As DateTime)

Try
' to fetch data in dataset1
cmdTest.CommandText = "clinicdb.dbo.sched1"
da.SelectCommand = cmdTest
cmdTest.Connection = cnBKTest
cmdTest.CommandType =

Data.CommandType.StoredProcedure
cmdTest.Parameters.Add(New

SqlParameter("@pn", Data.SqlDbType.DateTime, 10))
cmdTest.Parameters("@pn").Value = caldate
cnBKTest.Open()
da.Fill(dset1)
'cmdTest.ExecuteNonQuery()
Catch ex1 As Exception
MsgBox(ex1.Message, MsgBoxStyle.OkOnly,

"Error while connecting")
Finally

cnBKTest.Close()
End Try
end sub


//The first sp is working well and fetching data but not the second thru sixth.



--------------------------------------------------------
Listed below are stored procedures called in above

command (The same code below we are using for rest 5

stored procedures with diff. variable name.)
--------------------------------------------------------
//(Variable -> sched2,sched3,sched4 etc for others SPS)

Create procedure dbo.sched1
@pn as datetime
as select patient.pname as pn
from patient
inner join scheduleclinic
on patient.p_id= scheduleclinic.p_id
where scheduleclinic.room_no = 1 and

scheduleclinic.sdate = @pn
order by scheduleclinic.stime

===AKKI===