过程或函数'BindSectionByTeacher'需要未提供的参数'@SchoolId'. [英] Procedure or function 'BindSectionByTeacher' expects parameter '@SchoolId', which was not supplied.

查看:120
本文介绍了过程或函数'BindSectionByTeacher'需要未提供的参数'@SchoolId'.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个查询,我试图在一个下拉列表中绑定类,但它显示以下错误...

过程或函数"BindSectionByTeacher"需要参数"@SchoolId",但未提供."

我了解了错误,但我想我已经提供了SchoolId....以下是我的查询....

I have a query and i am trying to bind class inside a dropdown but it showing the following error...

"Procedure or function ''BindSectionByTeacher'' expects parameter ''@SchoolId'', which was not supplied."

I Understand the error but i think i have supplied the SchoolId ....Below is my query....

ALTER PROCEDURE [dbo].[BindClassByTeacher]
@TeacherId int,
@SchoolId int
AS
BEGIN
    select T.AllowtedClass,T.ClassId from TeacherAllowtedClass T
    inner join SchoolMaster S
    on S.School_ID=T.School_ID
    where  T.School_ID=@SchoolId and T.Teacher_ID=@TeacherId
    Order by T.ClassId
END



我的后端编码是...



and my backend coding is...

DbConnection bind = new DbConnection();
            bind.BindDropdownlist_para(ddlclass, "[BindClassByTeacher]", "AllowtedClass", "ClassId", "@SchoolId", Session["School"].ToString(),
                "@TeacherId", Session["teacherid"].ToString());





Allowted Class ClassId
   11th   	2
   Nursery	4
   10th	        8




请尝试帮助我...谢谢....




Please try to help me...thanx....

推荐答案

嗨阿什拉夫(Ashraf),

在您的存储过程中,输入参数的类型为整数.在后面的代码中,您正在使用字符串值.

我认为这就是为什么您会出错.检查一次.
Hi Ashraf,

In your stored procedure input parameters are of type integer. And in code behind you are using string values.

I think that is why you are getting error. Check that once.


在下面的代码中将字符串转换为int

使用Convert.ToInt32(Session ["School"])代替Session ["School"].ToString()
Convert the string to int in the below code

Use Convert.ToInt32(Session["School"]) instead of Session["School"].ToString()


这篇关于过程或函数'BindSectionByTeacher'需要未提供的参数'@SchoolId'.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆