• 2021/09/23

1、System.Data.Entity.ModelConfiguration.ModelValidationException:“One or more validation errors were detected during model generation:

在模型生成期间检测到一个或多个验证错误;

解决方法:model文件下添加public int Id { get; set; }

2、在多语句事务内不允许使用 CREATE DATABASE 语句。

解决方法:迁移数据库;

3、运算符"=="无法应用于"string"和"char"类型的操作数;

4、System.IndexOutOfRangeException
  HResult=0x80131508
  Message=在位置 0 处没有任何行。
  Source=<无法计算异常源>
  StackTrace:
<无法计算异常堆栈跟踪>

  • 2021/09/24
using (TransactionScope transaction = new TransactionScope())   //将datetable里的数据写到数据库里
            {
                for (int i = 0; i < table.Rows.Count; ++i)
                {
                    //DataRow[] af = table.Select(table.Rows[i][1] = 'a');
                    if (table.Rows[i