/* *连接到数据库 */ // print "$tablex\n"; $connection = odbc_connect("fxhldata","dba","sql"); $query = "select * from l10 where (yh=$yh and lylx=$lylx)" ; $result = odbc_do($connection,$query) ; /* *用一个include好好用 *当tablex值为空时默认第一个表 */
include "table$tablex.php";
odbc_close($connection); ?>
按照图片的方法配置了ODBC。 <? odbc_connect("我的数据源名称","我的用户名","我的密码"); ?>接着报错 Warning: SQL error: [Microsoft][ODBC 驱动程序 管理器] 未发现数据源名称并且未指定默认驱动程序, SQL state IM002 in SQLConnect in c:/test/search.php on line 2
看看这帖吧
$dbc = new COM("ADODB.Connection") or die("ADO 连接创建失败!");
$dbc->Provider = "MSDASQL";
$dbc->Open("db1.mdb");
$rs = $dbc->Execute("select * from 学生");刚用第一句就报错,请问哪里错了?
/*
*连接到数据库
*/
// print "$tablex\n";
$connection = odbc_connect("fxhldata","dba","sql");
$query = "select * from l10 where (yh=$yh and lylx=$lylx)" ;
$result = odbc_do($connection,$query) ;
/*
*用一个include好好用
*当tablex值为空时默认第一个表
*/
include "table$tablex.php";
odbc_close($connection);
?>
<?
odbc_connect("我的数据源名称","我的用户名","我的密码");
?>接着报错
Warning: SQL error: [Microsoft][ODBC 驱动程序 管理器] 未发现数据源名称并且未指定默认驱动程序, SQL state IM002 in SQLConnect in c:/test/search.php on line 2
请把答案贴到到我的问题帖子里,解决了一定给分!!!
http://www.csdn.net/Expert/TopicView1.asp?id=605731