ConnectionString= "Provider=Microsoft.Jet.OLEDB.4"/> ConnectionString= "Provider=Microsoft.Jet.OLEDB.4">

ACCESS SQL语句为什么 返回空集

WBOY
Release: 2016-06-13 12:15:23
Original
1272 people have browsed it

ACCESS SQL语句为何 返回空集,

<br /><br /><br />$conn = @new com("ADODB.Connection") or die ("ADO连接失败!"); <br />$conn->ConnectionString= "Provider=Microsoft.Jet.OLEDB.4.0;User Id=admin;jet OleDB:Database password=tttt;Data Source=d:/u200/tmkq.mdb";<br />$conn->Open(); <br />if ($emp_rang==""){<br />	$sql_str="select Employee.emp_id,Employee.emp_name From Employee";<br />}else{<br />	$sql_str='select Employee.emp_id,Employee.emp_name From Employee where Employee.emp_id="'.$emp_rang.'"';<br /><br />}<br />echo $sql_str;<br /><br />$rs_emp=$conn->Execute($sql_str);<br /><br />
Copy after login

程序要求$emp_rang为空时 返回全部记录 , (这句正常,能返回全部记录)
$emp_rang不为空是 (就是有指定内容时) 返回指定EMP_ID 的记录  这里不正常一直返回空值

还希望能够多选, 比如 $emp_rang="a001,a002,a003"
如何返回3条记录...
------解决思路----------------------
where Employee.emp_id in ('a001', 'a002')
------解决思路----------------------
$emp_rang="a001,a002,a003"

如果多个条件是独立的,那么需要用到in
$emp_rang in ("a001,a002,a003")

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template