MySQL 1452 ERROR

今天在数据库添加外键的时候,遇到了问题。先创建了两个表  orders 和 order_items  ,存储引擎都是InnoDB,且都有orderid这个属性(类型完全一样)。

但是当使用命令:

alter table order_items

add foreign key (orderid) references orders (orderid);
添加外键的时候 出现了错误

ERROR 1452 : Cannot add or update a child row: a foreign key constraint fails

最后才发现,原来是我的order_items表中已经存在了数据,且orderid这个属性和orders中的不对应,因此如果添加外键,就会导致错误
此时解决的办法不外乎两个:

1.删除数据,再添加外键
2.在orders中添加对应的项,再添加外键

=============这是一篇转载,下面是引用地址=============

http://www.2cto.com/database/201210/159205.html

早知道早上来查了,费了我一下午的劲

VERIFIED

Since 2 days ago I have been trying to verify the finger print using the tempate restore from the mysql database  but never find out the reason why the verification operation fails. today I must match the stored finger  print temlate and the sampled finger print feature set. After checking out bundles of web site but I found nothing related to the verification failure. BTW I use the free One Touch SDK and URU4500 scanner. Actually I was in deep desperation when none of the web sites explain why the verification fails. I found the finger print template data contains nothing if I use memory stream to rebuild the template, and the memory stream retrieves the data from byte array using Write method.

Under the condition that the memroy stream Write method doesn’t work, I had to try finger print template’s another deserialize method, Deserialize, fortunately, it works.

right index finger print verified

nothing in finger print template if restored from memory stream

树结构数据->EXCEL初战告捷

把结构树的数据输出为excel表格的需求是Hu领导提出来的,今天早上刚刚把结构树画出来,但是距离需要的形式还有电源

今早战果
需要的表格形式

Posted in

excel 0x800A03EC 错误一则

关于0x800A03EC 的excel错误已经在网上搜搜刮刮两个礼拜了,但是一直没有头绪,实在不知道当前的错误对应着网上说的哪个类型,而且每个类型的错误解决方法也并不一定都有明确说明,这个让人很头疼。

1. There’s a mis-match between the Office interface language and the Windows Regional language

2. The cell address is invalid for the action you propose

3. Excel is in editing mode and can therefore not accept in-coming commands

原本没有用递归的时候其实都是好好的,所有的一切都跟MSDN上示例演示的一样一样的,但是一进入递归调用函数就傻逼了,晚上想在睡觉前再看看有什么办法,就试一试验证一下是不是第二种错误。实际尝试代码修改如下:

  1. foreach (var bEle in bDoc)
  2. {
  3. if (bEle.Value.IsBsonDocument)
  4. {
  5. // BsonElement名
  6. curWorkSheet.Cells[curRow, curCol] = bEle.Name; // 刚刚进入递归操作Excel就完蛋,问题出在curRow, curCol的数值上
  7. // BsonElement子节点
  8. curCol++;
  9. BsonDocument subBDoc = (BsonDocument)bEle.Value;
  10. this.PrintExcel(ref curWorkSheet, subBDoc, curRow, curCol);
  11. }
  12. else
  13. {
  14. curWorkSheet.Cells[curRow, curCol] = bEle.Name.ToString();
  15. curWorkSheet.Cells[curRow, curCol + 1] = bEle.Value.ToString();
  16. //curRow++; //把这两行注释
  17. //curCol–;
  18. curRow = curRow + 2; // 换成其他的cell试试
  19. curCol = curCol + 2;
  20. }
  21. }

最后出来的excel表格其实是错的,因为单元格跟实际要求的对不上,但是好歹没有之前那个王八蛋错误了,不过实际还是得解决那个错误,原先该写的单元格还得写。

Posted in

几番辛苦

It’s been couple days, more exactly couple weeks, the mongodb client program prcess could not go further because the sever’s bind_ip parameter was set to the local machine. Through days hunting for the method to reset this parameter, leafing googles, sending group emails, finnally, tonight in the mongodb group on IRC some guy said

use mongod –bind_ip 0.0.0.0

and he then append

mongod –help

SO, it works, otherwise this blog would not have been released, although the database sever only turns off the bind_ip option when it is started from cmdline, when started as dienst not work, it is somehow progress.

Access the database via normal ip setting