//TODO:灵异事件,select 前加个空格有的会出错。
strSQL="select *,substring(convert(varchar(12),r_usetime,120),1,10) r_usetime," +
"(select fu_name from z_factory_user where fu_id=r.user_id) fu_name," +
"(select servername from server_info where server_code=r.server_id) servername," +
"(select zd_zmc from t_init_data_table_ where table_id = 'RepeaterInfo' and zd_zbh = r.repeater_type and zd_id='repeater_type') repeater_type2," +
"(select k.StationName from RepeaterInfo k where k.StationID=r.Host_id and k.host_id='') dev_name," +
"(select zd_zmc from t_init_data_table_ where table_id = 'RepeaterInfo' and zd_zbh = r.protype and zd_id='protype') protype2" +
" from  RepeaterInfo r where 1=1 and repeaterid=  " +
"'"+repeaterid+"'" ;
这段代码 不一样的地方就在
如果strSQL=" select *,多了个空格!!!!1.只有这里多了个空格,我的这串sql语句就查询不出来,如果去掉空格就好了,用jdbc查询。
2.如果在最后一行" from  RepeaterInfo r where 1=1 and repeaterid=  " +
"'"+repeaterid+"'" ;
 这个from前面多加个空格,也可以查询出来,如果没加又是查询不出来。请问各位高手,这个空格应该在String里面没什么问题吧,为什么我会碰到这么奇怪的问题,请指教。