1.Com link, ADODB. Connection
Copy CodeThe code is as follows:
$conn = new Com ("ADODB. Connection "); Instantiate a Connection object
$connstr = "provider=sqloledb;datasource=.; Uid=sa;pwd=123456;database=jnold; ";
$conn->open ($CONNSTR);
$rs = new Com ("ADODB. Recordset "); Instantiate a RecordCount object
$rs->open (' select * from News where bigclassid = Leadpostil and "is null ', $conn, 1, 1);
$count = $rs->recordcount;
echo "Total {$count} records
";
for ($i = 0; $i < $count; $i + +) {
$arr _result[$i [' title '] = Addslashes ($rs->fields (' title ')->value);//title
$arr _result[$i [' Color '] = addslashes ($rs->fields (' Titlecolor ')->value? $rs->fields (' Titlecolor ') Value: ");//Title Color
$arr _result[$i] [' wenhao '] = addslashes ($rs->fields (' Othertext ')->value);//Text number
}
2.ODBC Connection MSSQL
Copy CodeThe code is as follows:
$dbhost = ";
$dbuser = "; Your MSSQL user name
$dbpass = "; Your MSSQL code.
$dbname = "; The name of your MSSQL library
$connect =odbc_connect ("Driver={sql Server}; server= $dbhost;D atabase= $dbname "," $dbuser "," $dbpass ");
$sql = "SELECT * from Content";
$exec =odbc_exec ($connect, $sql);
while ($row = (Odbc_fetch_array ($exec)))
{
$row [' ID ']//? Fetch field Value
...
}
http://www.bkjia.com/PHPjc/326416.html www.bkjia.com true http://www.bkjia.com/PHPjc/326416.html techarticle 1.Com Link, ADODB. The Connection copy code code is as follows: $conn = new Com ("ADODB"). Connection "); Instantiate a Connection object $connstr = "provider=sqloledb;datasource=.; Uid=sa;p ...