mutil-key 好像不能用

Topics: User Forum
Jun 11, 2012 at 3:21 AM
Edited Jun 11, 2012 at 4:55 AM
    public class t_user : IDbObject
    {
        [DbKey(IsDbGenerate = false),Length(20)]
        public string Comid;
        [DbKey(IsDbGenerate = false),Length(2)]
        public string Sysverid;
        [DbKey(IsDbGenerate = false),Length(20)]
        public string Userid;
        [Length(50)]
        public string Password;
    }



var u = new t_user() { Comid = "2012002", Sysverid = "01", Userid = "aaa", Password="bbb" };
DbEntry.Context.Insert(u);
报错:Table 't_user' already exists.
Database is MySQL 5.1
Coordinator
Jun 11, 2012 at 5:26 AM

既然报错是 Table 't_user' already exists.,那就把 t_user 删掉啊。

Jun 11, 2012 at 1:49 PM

我是要在表 t_user 内增添一笔数据,
难道我语法写错了吗?
总不可能要增添一笔,就要把原有的Table删掉

Jun 11, 2012 at 3:03 PM

重新运行下可能就好了

Jun 13, 2012 at 9:27 AM

重新运行可以我就不用上来问了,
我把数据库换成Sql Server 2005没这问题,
使用MySQL就会报错

Coordinator
Jun 13, 2012 at 10:43 AM

把自动创建表关掉。

Jun 14, 2012 at 7:41 AM

把web.config的创建表关掉已解决此问题
<add key="AutoCreateTable" value="false"/>
感谢lifeng的回答