//SqlDataSource1.SelectCommand = "SELECT emp.name,emp.emp_id...";字符串没有拼接 写为一行代码如下,程序运行正常---
SqlDataSource1.SelectCommand
= "SELECT emp.name,emp.emp_id,city.city_name, depart.depart_name,emp.salsry FROM city_info city,empinfo emp ,department_info depart where city.city_code = emp.city_code and depart.depart_id = emp.dept_id and emp.name+cast(emp.emp_id as varchar)+city.city_name+depart.depart_name+cast(emp.salsry as varchar) like '%李%'";//SqlDataSource1.SelectCommand = "SELECT emp.name,emp.emp_id..."+""+"";
一个字符串写成有多行字符拼接而成时,系统报错。
SqlDataSource1.SelectCommand
= "SELECT emp.name,emp.emp_id,city.city_name,"
+"depart.depart_name,emp.salsry FROM city_info city,empinfo "
+"emp ,department_info depart where city.city_code = emp.city_code and +"depart.depart_id = emp.dept_id and emp.name+cast(emp.emp_id as varchar)+"+city.city_name+depart.depart_name+cast(emp.salsry as varchar) like '%李%'";请个位大哥有什么号办法,谢过各位。
SqlDataSource1.SelectCommand
= "SELECT emp.name,emp.emp_id,city.city_name, depart.depart_name,emp.salsry FROM city_info city,empinfo emp ,department_info depart where city.city_code = emp.city_code and depart.depart_id = emp.dept_id and emp.name+cast(emp.emp_id as varchar)+city.city_name+depart.depart_name+cast(emp.salsry as varchar) like '%李%'";//SqlDataSource1.SelectCommand = "SELECT emp.name,emp.emp_id..."+""+"";
一个字符串写成有多行字符拼接而成时,系统报错。
SqlDataSource1.SelectCommand
= "SELECT emp.name,emp.emp_id,city.city_name,"
+"depart.depart_name,emp.salsry FROM city_info city,empinfo "
+"emp ,department_info depart where city.city_code = emp.city_code and +"depart.depart_id = emp.dept_id and emp.name+cast(emp.emp_id as varchar)+"+city.city_name+depart.depart_name+cast(emp.salsry as varchar) like '%李%'";请个位大哥有什么号办法,谢过各位。
那么就是你错了,一般错误可能是引号不匹配,可能是连接符+后面的引号中的空格没有,等等!!
楼主只能仔细检查!!