[求助]SQL查询问题
string code=p.Drdladwcode+System.Convert.ToDateTime(p.Txtlasj).Year.ToString()+Convert.ToDateTime(p.Txtlasj).Month.ToString().PadLeft(2,'0').ToString();string dbString=ConfigurationSettings.AppSettings["dbString"];
SqlConnection con=new SqlConnection(dbString);
con.Open();
SqlCommand cmd=new SqlCommand("select count(*) from ajxxtable where ajbh like '%"+code+"%'",con);
int count=(int)cmd.ExecuteScalar();
我的这名SQL为什么总是查出的总数总是为0,我如果在数据库中之直接用select count(*) from ajxxtable where ajbh like '%code%'"却不为零。为什么查不出来,请指教。