function getstudentbystudentno(studentno:string):tstuden;
var
sql:string;
student:tstudent;
adoquery:tadoquery;
begin
adoquery:=tadoquery.create(nil);
sql:='select id,name,nation from 学生信息'+
' where id='+'''+studentNo+'''';
adoquery:=dahelper.exesqlquery(sql);
if(adoquery.recordcount<1) then
begin
result:=nil;
end
手机打的,累死了,最后的studentno就是id,我想实现模糊查询,后台数据库是sql server2005,这个where句该怎么改
谢谢各位大哥大姐了
var
sql:string;
student:tstudent;
adoquery:tadoquery;
begin
adoquery:=tadoquery.create(nil);
sql:='select id,name,nation from 学生信息'+
' where id='+'''+studentNo+'''';
adoquery:=dahelper.exesqlquery(sql);
if(adoquery.recordcount<1) then
begin
result:=nil;
end
手机打的,累死了,最后的studentno就是id,我想实现模糊查询,后台数据库是sql server2005,这个where句该怎么改
谢谢各位大哥大姐了
'select id,name,nation from 学生信息'+
' where id LIKE ''%'+studentNo+'%''';1,% :表示任意0个或多个字符。可匹配任意类型和长度的字符,有些情况下若是中文,请使用两个百分号(%%)表示。
比如 SELECT * FROM [user] WHERE u_name LIKE '%三%'
摘自:
http://www.cnblogs.com/GT_Andy/archive/2009/12/25/1921914.html
' where id LIKE ''%'+studentNo+'%''';
肯定可以的,你在SQL中测试下就知道了
如果没敲错
1L的应该可以的
http://download.csdn.net/detail/veron_04/1644211