本帖最后由 shelly1214chen 于 2009-09-14 15:37:20 编辑

解决方案 »

  1.   

    在设计表的时候,可以,主键值的 “默认值或绑定”那行写  (newid()) , 新插入的记录的key ,就是 DUID 那样的一串字符。
      

  2.   

    GUID只在以前的一个购物网站上用过的!
      

  3.   

     string strSqlInsert = "insert into [T_Area](Code,Name,AreaCode,GUID) values ('3333','嘉兴','嘻嘻','"+Guid.NewGuid()+"')";
                //string strSqlInsert = "insert into [T_Area](Code,Name,AreaCode) values ('2222','嘉兴','嘻嘻')";
                SqlCommand cmd=new SqlCommand(strSqlInsert,_sqlConnectionA);
                cmd.ExecuteNonQuery();
                
                cmd = new SqlCommand(strSqlInsert, _sqlConnectionB);
                cmd.ExecuteNonQuery();