先发表结构:
create table if not exists movieticket
(moviehall enum('一号厅', '二号厅', '三号厅', '五号厅') not null,
seatrow int unsigned not null,
seatcol int unsigned not null,
sellerid int unsigned not null, #售票员
moviename varchar(50) not null, #影片
movienameex enum('数字', '3D') not null,  #影片扩展名
seattype enum('普通区') not null,  #座位类型
tickettype enum('8折票', '7折票', '儿童票', '优惠票') not null, #票类
ticketprice decimal(5, 2) unsigned not null, #票价
ticketnum varchar(20) unique not null, #票号
selldate date not null, #日期
selltime time not null, #时间
scene int unsigned not null, #场次
constraint pk_ticket primary key(moviehall, seatrow, seatcol, selldate, scene),
constraint fk_seller foreign key(sellerid) references seller(sellerid)
);在VS2008中有这么一段代码(控制台程序): std::string sentence = "insert into movieticket values ('一号厅', 7, 5, 1, '地震', '3D', '普通区', '优惠票', 50, '100729082', '2010-8-3', '15:18:0', 1)"; //表内并没有这条记录
//std::string sentence = "insert into seller(truename, username, password) values ('人人人', 'ab', '123')";   //此语句能正确执行 isSelect = false;
if(0 != mysql_real_query(mysql_, sentence.c_str(), sentence.length()))  ------1
{
const char * str = mysql_error(mysql_);
return false;
}在句1处F10, 调试光标即消失不见,弹出控制台界面,下面的内容没有执行。就好像是被卡在了那一句一样。请问各位这个问题要怎么解决?

解决方案 »

  1.   

    直接到MYSQL中试一下这条语句看看有没有问题。
    insert into movieticket values ('一号厅', 7, 5, 1, '地震', '3D', '普通区', '优惠票', 50, '100729082', '2010-8-3', '15:18:0', 1)
      

  2.   

    在MYSQL中直接运行,是否有出错提示
      

  3.   

    在SQL中直接执行是没有问题的,我用mysql workbench,在编辑mysql 脚本的时候,在创建表之后就直插入了几条测试语句,然后再在VS中执行这个句子就出现那个问题,但是如果在编辑脚本的时候取消掉那几条插入语句,全部在VS中插入就不会有问题,不知道是不是有什么如果在编辑脚本的时候插入就把表给锁住了啊