'与MYSQL数据库连接成功
'下列代码有什么问题吗?
'为什么不能释放被锁住的表?
con1.Execute "lock tables tabName;"
con1.Execute "insert into tabName(......) values(......);"
con1.Execute "unlock tables;"
'tabName 是要操做的表的名称
'con1 是数据库连接名
'下列代码有什么问题吗?
'为什么不能释放被锁住的表?
con1.Execute "lock tables tabName;"
con1.Execute "insert into tabName(......) values(......);"
con1.Execute "unlock tables;"
'tabName 是要操做的表的名称
'con1 是数据库连接名
conn1.begintrans '开启事务
con1.Execute "insert into tabName(......) values(......);"
con1.commitrans '提交事务
但希望在操作时将表锁住
每次都要退出程序才能解锁
代码中的 unlock tables 竟然没有用??? 为什么???
我个人认为MySQL接口与ado不很匹配。
'下列代码有什么问题吗?
'为什么不能释放被锁住的表?
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(名称)