Click here to Skip to main content
15,904,652 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
first i submitted my code:
C#
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-"
C#
An expression of non-boolean type specified in a context where a condition is expected, near ')'.

why?

What I have tried:

I'm getting below error.
thank your in advance all of you..
Posted
Updated 22-Feb-16 20:17pm
Comments
[no name] 23-Feb-16 2:18am    
You should finish this part "....(select per_meal from bazar)";
Member 11072671 23-Feb-16 10:51am    
i want to get one column value from one table and another column value from another table by select satatement. how i will do?

1 solution

Your query syntax is not correct. Check the select statement in the where clause.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900