$dsn = ‘sqlsrv:server=.\SQLExpress;Database=thinkphp‘; $user = ‘admin‘; $password = ‘pass1234‘; try { $conn = new PDO($dsn, $user, $password); } catch (PDOException $e) { echo ‘Connection failed: ‘ . $e->getMessage(); } $conn -> beginTransaction (); $conn ->exec("create table think_form( id int identity(1,1) Not Null, title varchar(255) Not Null, content varchar(255) Not Null, create_time datetime Not Null, Primary Key(id)) "); $conn -> commit (); $conn = null;
PDO beginTransaction (),exec(),commit (),布布扣,bubuko.com
PDO beginTransaction (),exec(),commit ()
原文:http://www.cnblogs.com/dangkei/p/3867934.html