在期望条件的上下文中指定的非布尔类型的表达式,在')'附近。 [英] An expression of non-boolean type specified in a context where a condition is expected, near ')'.

查看:85
本文介绍了在期望条件的上下文中指定的非布尔类型的表达式,在')'附近。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先我提交了我的代码:

first i submitted my code:

SqlConnection con = new SqlConnection("server=.; database=Hall_management_system;user=sa;password=11;integrated security=true;");
            con.Open();
            DataSet ds1 = new DataSet();
            DataTable FromTable1 = new DataTable();
            string cmdstr = "select total_pay,current_meal,total_meal_cost,total_cost,remaining from meal_member where regestration_number=@regestration_number and (select per_meal from bazar)";
            SqlCommand cmd = new SqlCommand(cmdstr, con);


            cmd.Parameters.AddWithValue("@regestration_number", Session["user"]);

            SqlDataAdapter adp1 = new SqlDataAdapter(cmd);
            adp1.Fill(ds1);
            DataList2.DataSource = ds1.Tables[0];
            DataList2.DataBind();



当我运行此代码然后显示此错误按摩 -


when i run this code then show this error massage-"

An expression of non-boolean type specified in a context where a condition is expected, near ')'.



为什么?



我的尝试:



我' m得到以下错误。

提前感谢你们所有人..


why?

What I have tried:

I'm getting below error.
thank your in advance all of you..

推荐答案

你的查询语法不正确。查看select语句在where子句中。
Your query syntax is not correct. Check the select statement in the where clause.


这篇关于在期望条件的上下文中指定的非布尔类型的表达式,在')'附近。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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