初次使用PostgreSql,使用.net 开放webapi,连接正常,读取数据
NpgSql语句:Select * From TbJyXm
时出现如下问题:
{“message”:“发生错误。”,“exceptionMessage”:“错误:42P01:关系\“tbjyxm \”不存在”,“exceptionType”:“Npgsql.NpgsqlException”,“stackTrace”:“在Npgsql.NpgsqlState .<ProcessBackendResponses>d__0.MoveNext()\r\n 在 Npgsql.ForwardsOnlyDataReader.GetNextResponseObject(布尔清理)\r\n 在 Npgsql.ForwardsOnlyDataReader.GetNextRowDescription()\r\n 在 Npgsql.ForwardsOnlyDataReader.NextResultInternal()\r\ n 在 Npgsql.ForwardsOnlyDataReader..ctor(IEnumerable`1 dataEnumeration、CommandBehavior 行为、NpgsqlCommand 命令、NotificationThreadBlock threadBlock、Boolean preparedStatement、NpgsqlRowDescription rowDescription)\r\n 在 Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb)\r\n 在 Npgsql。 NpgsqlCommand.ExecuteReader(CommandBehavior cb)\r\n 在 Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior 行为)\r\n 在 System.Data.Common.DbCommand.Syste

在使用.NET开发WebAPI并连接PostgreSQL数据库时,遇到查询TbJyXm表出错的问题。原因是PostgreSQL遵循snake_case命名规则,将表名自动转为小写。通过将表名改为tbjyxm并调整查询语句,成功解决了这个问题。
最低0.47元/天 解锁文章
1267






