在新的Win10上裝上XAMPP後發現CI連不上SQL Server,於是先用原生的方式找到解決的方法
$serverName = "localhost\sqlexpress";
$connectionInfo = array( "Database"=>"Pos", "UID"=>"sa", "PWD"=>"");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.
";
}else{
echo "Connection could not be established.
";
die( print_r( sqlsrv_errors(), true));
}
才知道WIN10預設沒有ODBC Driver 11 for SQL Server
https://www.microsoft.com/zh-TW/download/details.aspx?id=36434