Giter Site home page Giter Site logo

Comments (4)

anjoy8 avatar anjoy8 commented on May 13, 2024 1

【原因】:这个错误是由于model实体层,codefirst 生成数据库的时候,sql语句不支持mysql造成的,多半是多了一个逗号。

【起因】:
为了满足sqlserver支持中文字符,所以在model实体上加上属性:

[SugarColumn(Length = 50, IsNullable = true,ColumnDataType ="nvarchar")]
public string CreateBy { get; set; }

【结果】:
虽然在Sqlite 和 Sqlserver中正常,但是在Mysql中应该是多了一个 逗号 导致异常 。

【方案】:
目前已经解决,但是如果自己写的时候,不要加这个 ColumnDataType ="nvarchar" 特性即可。

from blog.core.

binyly avatar binyly commented on May 13, 2024 1

那就是说你又要改回去了洛? 这个 ColumnDataType

from blog.core.

anjoy8 avatar anjoy8 commented on May 13, 2024

那就是说你又要改回去了洛? 这个 ColumnDataType

我发现了一个规律,就是有一部分有影响,有一部分没有,
经过测试,好像把最后一个 string 类型的 ColumnDataType 去掉,上边的不去掉,依然通过,就是目前我线上的版本。

但是为了防止其他情况,还是都去掉吧。

这个bug还需要深究,虽然这个 nvarchar 并没有太大的影响,毕竟Mysql 没有这个db类型。

from blog.core.

anjoy8 avatar anjoy8 commented on May 13, 2024

【最终的方案】:
因为sqlsugar初始化mysql数据库的时候,不能指定字符集,所以如果创建数据库乱码的话,自己手动先创建一个utf-8的空数据库吧,然后再生成表和表数据。

from blog.core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.