'与MYSQL数据库连接成功
'下列代码有什么问题吗?
'为什么不能释放被锁住的表?
con1.Execute "lock tables tabName;"
con1.Execute "insert into tabName(......) values(......);"
con1.Execute "unlock tables;"
'tabName 是要操做的表的名称
'con1  是数据库连接名

解决方案 »

  1.   

    '楼主用事务试试:
    conn1.begintrans   '开启事务
    con1.Execute "insert into tabName(......) values(......);"
    con1.commitrans    '提交事务
      

  2.   

    我知道可以用事务
    但希望在操作时将表锁住
    每次都要退出程序才能解锁
    代码中的 unlock tables 竟然没有用??? 为什么???
      

  3.   

    解决问题为本,别执意!
    我个人认为MySQL接口与ado不很匹配。
      

  4.   

    '与MYSQL数据库连接成功
    '下列代码有什么问题吗?
    '为什么不能释放被锁住的表?
    con1.Execute "lock tables tabName;"
    con1.Execute "insert into tabName(......) values(......);"
    con1.Execute "unlock tables;"
    'tabName 是要操做的表的名称
    'con1  是数据库连接名
    使用这种加锁方法问题:
    程序出问题表就锁住解不开了
    1,添加时不用使用锁
    2,加锁应该表明是什么锁,否则他把所有的表都锁住了
    LOCK TABLES trans READ, customer WRITE;
    select sum(value) from trans where customer_id= some_id;
    update customer set total_value=sum_from_previous_statement
               where customer_id=some_id;
    UNLOCK TABLES;3,应该使用模拟锁getlock(名称,1)
     和releaselock(名称)